Commit Graph

67 Commits

Author SHA1 Message Date
Sujay Jayakar e03d61cce8 Merge pull request #36 from djudd/compatibility-quick-checks
Add quick check implementations for NFKC & NFKD
2019-01-14 22:40:37 +05:30
David Judd 5685166427 Add quick check implementations for NFKC & NFKD 2019-01-12 14:44:53 -08:00
Manish Goregaokar 534e19eed8 Merge pull request #34 from dotdash/improv_codegen
Generate code that is friendlier to rustc's item_bodies_checking
2019-01-08 09:35:49 -08:00
Björn Steinbrink 41914c5d30 Generate code that is friendlier to rustc's item_bodies_checking
Having the Some() constructor in each match arm body puts extras stress
on rustc's item_bodies_checking pass. We can work around that by moving
the Some() constructor around the match, and directly returning None
from the default arm, which is the only one that generates a None value.

On my box, this almost cuts the time spent in item_bodies_checking in
half, going from about 8.7s to about 4.6s, and reduces the complete
compile time from about 13s to about 9s, so about a third less.

There are no changes in performance in `cargo bench`.

Note that doing the same for the composition_table() function does not
yield any compile time wins, but would cause a performance regression.

cc #29
2019-01-08 17:02:41 +01:00
Manish Goregaokar 3a99765a62 Merge pull request #27 from dbrgn/ci
CI: Test on stable, nightly and 1.21
2018-06-14 14:47:20 -07:00
Danilo Bargen cf80b56ce6 Link to docs.rs
This way we don't have to build custom docs anymore.
2018-06-14 23:45:23 +02:00
Danilo Bargen f99bfdf347 Travis: Test on stable, nightly and 1.21 2018-06-14 10:24:09 +02:00
Sujay Jayakar c9438425fd Merge pull request #25 from sujayakar/bump-version
Bump version (and update docs)
2018-05-09 12:42:33 -07:00
Sujay Jayakar 7389eb31f1 Bump version (and update docs) 2018-05-09 12:39:23 -07:00
Sujay Jayakar 45364f03c2 Merge pull request #24 from sujayakar/quick-ss
Implement Stream-Safe QuickCheck variant
2018-05-09 12:04:58 -07:00
Sujay Jayakar ef9a4dd691 Implement Stream-Safe QuickCheck variant 2018-05-07 20:55:59 -07:00
Sujay Jayakar 8dc3dc3932 Merge pull request #23 from sujayakar/hangul-fix
Fix corner case in Hangul composition
2018-05-07 20:08:30 -07:00
Sujay Jayakar ef810e3380 Update range naming 2018-05-07 20:02:04 -07:00
Sujay Jayakar 3156992b87 Factor out T_START from match statement 2018-05-07 19:14:55 -07:00
Sujay Jayakar 9f6cc853cc Fix corner case in Hangul composition 2018-05-07 15:34:22 -07:00
Alex Crichton 75a37d6c6c Merge pull request #22 from sujayakar/unicode-opts2
Implement Stream-Safe Text Process and QuickCheck algorithms
2018-05-02 11:04:34 -05:00
Sujay Jayakar 4d7e81e0ab Add Stream-Safe Text Process (for interop with golang's unicode/norm package) 2018-05-01 21:43:04 -07:00
Sujay Jayakar 6a7e38e376 Refactor Unicode script, emit new tables, and add QuickCheck algorithm. 2018-05-01 21:00:38 -07:00
Sujay Jayakar 4d76b961b8 Remove unnecessary unwrap in recompose 2018-04-27 13:37:29 +05:30
Sujay Jayakar 74dddd6f8d Remote unnecessary transmute (in favor of char::from_u32_unchecked) 2018-04-27 13:37:20 +05:30
Sujay Jayakar 0e821ff949 Simplify decomposition
- Eliminate custom sorter
  - Only sort the "pending" suffix of the buffer
2018-04-27 13:37:16 +05:30
Sujay Jayakar e97357d282 Add benchmarks 2018-04-27 13:37:08 +05:30
Simon Sapin 97ebf36266 Update version in README 2017-06-15 17:43:11 +02:00
Simon Sapin 22f67aced1 Merge pull request #17 from behnam/dev
Fix is_combining_mark table data
2017-06-15 17:39:28 +02:00
Behnam Esfahbod 0f11303c65 Bump version to 0.1.5 2017-06-01 15:21:31 -06:00
Behnam Esfahbod 1e74c347b6 Fix is_combining_mark table data
* In `scripts/unicode.py`, the data used to generate `is_combining_mark()`
was being passed to the emit function incorrectly, resulting in the
table containing some other data instead. The script is fixed and new
`tables.rs` is generated.

* Add test for `is_combining_mark()` for ASCII chars, as well as a
couple of random chars based on the reported issue.

Fix https://github.com/unicode-rs/unicode-normalization/issues/16
2017-06-01 15:10:29 -06:00
Simon Sapin 3898e77b11 Merge pull request #14 from froydnj/trim-unicode-tables
reduce space required by decomposition and composition tables
2017-04-12 17:11:46 +08:00
Manish Goregaokar 6dbfd72adc Merge pull request #12 from clarcharr/master
Implement Display for Recompositions, Decompositions
2017-04-02 11:15:38 -07:00
Nathan Froyd 8d01bc5e88 store smaller slices in unicode data tables
Rust's default slices are convenient, but for tables like:

  const f: &'static [(char, &'static [char])]

they take up far too much space.  An element of the above array consumes
24 bytes on 64-bit platforms, and unicode-normalization contains about
6000 such array elements.

A better approach is to manually store a smaller slice type:

  struct Slice {
    offset: u16,
    length: u16,
  }

  const f: &'static [(char, Slice)]

and store the actual character data in a separate array on the side.
The `Slice` structures then point in to this separate array, but at a
much smaller space cost: elements of the modified `f` take up only 8
bytes on 64-bit platforms, which implies a space savings of ~96K on
64-bit platforms.  On some systems, this strategy also eliminates the
necessity of run-time relocations, which can be a further, significant
savings in binary size and runtime cost.

This change is strictly local to the library; it does not affect the
public API.
2017-03-27 16:58:31 -04:00
Nathan Froyd 7552e6cd2b format tables with one entry per line
This change avoids formatting table entries into a string, only to split
them apart again.  The new format is also slightly easier to read and
compare when changes are made to how the tables are organized.
2017-03-27 15:13:36 -04:00
Nathan Froyd 6190241cc9 use more idiomatic python in unicode.py
STR.join(...) is better than manual `for` loops that remember whether
we've processed the first element.
2017-03-27 14:26:35 -04:00
Simon Sapin 414a14f653 Merge pull request #13 from Manishearth/ignore-txt
Ignore .txt files so that they don't get published
2017-02-04 17:23:20 +01:00
Manish Goregaokar 0b717f8c08 Ignore .txt files so that they don't get published 2017-02-03 16:52:48 -08:00
Clar Charr 2d5988475c Implement Display for Recompositions, Decompositions. 2017-01-16 16:37:01 -05:00
kwantam 7625142dee update version numbers in README and lib.rs comments 2016-12-23 15:47:20 -08:00
Simon Sapin b3a331caed Merge pull request #10 from unicode-rs/9
Update to Unicode 9.0.0
2016-12-20 00:05:37 +01:00
Simon Sapin 7299191fce Update to Unicode 9.0.0 2016-12-20 00:03:22 +01:00
Manish Goregaokar e4fd0e1b21 Do not further compose LVT hangul precomposed syllable blocks
Fix #11.

The algorithm for composition of Hangul Jamo is:

 - L (choseong jamo) + V (jungseong jamo) = LV (syllable block)
 - LV (syllable block) + T (jongseong jamo) = LVT (syllable block)

However, the LV and LVT syllable blocks are intermingled in the unicode
block. In particular, for each pair LV, you will first see the syllable block
LV, followed by syllable blocks for LVT for each T. The LV+T
composition was a simple addition of offsets.

Our algorithm did not ignore the LVT syllable blocks, which meant that
LVT+T would just offset further and produce an unrelated syllable block.

By ensuring that the `S_index` is a multiple of `T_count`, we filter
for only LV syllable blocks (which occur every `T_count` codepoints in
the S block)
2016-12-20 00:03:14 +01:00
Simon Sapin cd9a45ea2a Merge pull request #9 from unicode-rs/is_combining_mark
Add a `char::is_combining_mark` function.
2016-01-18 17:12:33 +01:00
Simon Sapin 5d0443bd92 Add a char::is_combining_mark function.
This is used for international domain name validation:
http://unicode.org/reports/tr46/#Validity_Criteria

> The label must not begin with a combining mark, that is: General_Category=Mark.
2016-01-15 17:49:39 +01:00
kwantam 5ea0cec111 update Cargo.toml example to correct version number 2015-08-20 11:09:55 -04:00
kwantam 9b970231cf bump to 0.1.1 2015-07-08 22:59:50 -04:00
kwantam 0c5758fe36 Merge pull request #8 from Florob/unicode8.0.0
Update to Unicode 8.0.0
2015-07-08 22:56:53 -04:00
Florian Zeitz 5f26506035 Update to Unicode 8.0.0 2015-07-08 12:46:46 +02:00
Simon Sapin 3933917cff Merge pull request #4 from unicode-rs/char_iter_alternative
Add APIs to normalize arbitrary `char` iterators rather than just `str`.
2015-04-21 20:24:00 +02:00
kwantam 3cc8effc71 bump version to 0.1.0 2015-04-21 13:56:25 -04:00
kwantam 4354885c0e Merge pull request #5 from unicode-rs/char_iter_alternative_test
Minor changes for #4
2015-04-21 13:36:03 -04:00
Alex Crichton c4445c73d6 Merge pull request #6 from unicode-rs/doc-link
Add documentation link
2015-04-21 08:15:43 -07:00
Simon Sapin 0e7791feff Remove the str module and move its content to the crate top-level.
It not just about `str` anymore, since it now also accepts iterators.
2015-04-21 09:50:49 +02:00
Simon Sapin 91011de3f9 Remove the redundant src/str.rs file. 2015-04-21 09:48:15 +02:00