Commit Graph

539 Commits

Author SHA1 Message Date
Dave Abrahams
0aaceb60d3 [stdlib] UnicodeDecoders: handle UTF16 2017-04-28 10:34:39 -07:00
Dave Abrahams
1cfce45147 [stdlib] UnicodeDecoders: generalization preparing for UTF16 2017-04-27 20:44:45 -07:00
Dave Abrahams
4e802e2f51 [stdlib] UnicodeDecoders: A *little* cacheing builds character
Speeds up the unicode scalar view around 20%.  Now we are reasonably confident
we don't need a more sophisticated API for decoding than the one we've got, and
can move toward integration.
2017-04-27 16:48:39 -07:00
Dave Abrahams
5ad4ef4508 [stdlib] UnicodeDecoders: bidirectional UnicodeScalar view
Reverse iteration over a collection is significantly slower than forward.

REVERSE_COLLECTION

user	0m4.609s
user	0m4.587s
user	0m4.585s

COLLECTION

user	0m3.423s
user	0m3.517s
user	0m3.492s
2017-04-27 14:00:18 -07:00
Dave Abrahams
16e42d3d04 [stdlib] UnicodeDecoders: dumber is faster
A really simpleminded Collection view is faster by far than trying to cache all
that information.

I believe we could do even better by storing a simpler cache in the indices of
the view, but performance is already in decent shape, so we can put off
further optimization:

BASELINE
user	0m2.864s
user	0m2.775s
user	0m2.763s

SEQUENCE
user	0m2.632s
user	0m2.571s
user	0m2.553s

COLLECTION
user	0m3.553s
user	0m3.567s
user	0m3.475s
2017-04-27 08:09:00 -07:00
Dave Abrahams
662ea1f8a0 [stdlib] UnicodeDecoders: basic view proof-of-concept
Implements Sequence and Collection views over arbitrary CodeUnits, demonstrating
that indexing is possible.  However, collection-style decoding is approximately
3x slower than sequence-style, because Decoders have a fundamentally
Sequence-oriented interface.  I think I know what needs to be done to get
parity.
2017-04-26 17:01:48 -07:00
Dave Abrahams
63a2033945 [stdlib] UnicodeDecoders: separate EncodedScalar from Buffer
New code I'm writing doesn't seem to make sense with the two things collapsed.
2017-04-26 17:01:48 -07:00
Dave Abrahams
1753e66d55 [stdlib] UnicodeDecoders: further 10% speedup
Handling in bit counts rather than shuttling back and forth between bit counts
and code unit counts saves a lot.
2017-04-25 23:51:34 -07:00
Dave Abrahams
65daf5d7e6 [stdlib] UnicodeDecoders: follow some naming conventions 2017-04-25 23:41:17 -07:00
Dave Abrahams
1247164fe8 [stdlib] UnicodeDecoders: eliminate a redundant check
This finally makes us measurably faster than the BASELINE, existing code in
master:

BASELINE
user	0m2.869s
user	0m2.890s
user	0m2.893s
FORWARD
user	0m2.727s
user	0m2.730s
user	0m2.737s
REVERSE
user	0m2.417s
user	0m2.418s
user	0m2.416s
2017-04-25 23:26:24 -07:00
Dave Abrahams
e0e18a986e [stdlib] UnicodeDecoders: traffic in high-level buffers 2017-04-25 23:17:12 -07:00
Dave Abrahams
8a2ca78e50 [stdlib] UnicodeDecoders: Actually using high-level buffer 2017-04-25 20:08:39 -07:00
Dave Abrahams
824af8cade [stdlib] UnicodeDecoders: improved benchmark instructions 2017-04-25 18:51:53 -07:00
Dave Abrahams
76b188f9dd [stdlib] UnicodeDecoders: inject _UIntBuffer
Use something a little higher-level for buffering bytes, so we can give the
Decoder's buffer a Collection requirement, on the way to building indexable
transcoded collections.

For now, we're still reaching into our high-level data structure's stored
properties rather than using its API.
2017-04-25 18:38:44 -07:00
Dave Abrahams
503fba9952 Rename _buffer -> _bufferStorage 2017-04-25 17:27:45 -07:00
Dave Abrahams
06ee85c0fb [stdlib] UnicodeDecoders: nix wrong forward/reverse relationship
There may be a reason to do something like this once we start hooking up
indices, but the relationship isn't what we thought.
2017-04-25 16:57:38 -07:00
Dave Abrahams
a1686dc384 [stdlib] UnicodeDecoders: minor simplification/cleanup 2017-04-25 11:07:11 -07:00
Maxim Moiseev
13abb9a0a7 [stdlib] BinaryInteger func word(at:) => var words: Words (#8984)
* [stdlib] Underscoring BinaryInteger.word(at:)

* [stdlib] Implementing var words in terms of _word(at:)
2017-04-25 08:45:01 -07:00
Dave Abrahams
c2a92a695c Prototype stateful Unicode decoding
Having looked at the old transcoding code, it's very clear that no stateless
scheme has a hope of competing with it on performance.  We just need reverse
transcoding and a way to hook up indices (I believe we can use IndexingIterator
for this, that's coming).

This code demonstrates UTF-8 (the hard one) and is competitive on performance
with the existing code.  I believe it could be even better-performing if the
cases that do parsing were connected directly with the cases that do decoding.

Finally, tatoo this on your forehead: Dmitri Shall Not Be Underestimated
2017-04-24 17:31:42 -07:00
Maxim Moiseev
10da98abb9 Merge pull request #8851 from moiseev/integer-fixes
[stdlib] A few Swift 3 compatibility fixes
2017-04-20 10:45:02 -07:00
Max Moiseev
b41dd17edd [stdlib] Swift 3 XXXWithOverflow methods for integers 2017-04-19 11:24:58 -07:00
practicalswift
6e4547bb66 [gardening] Fix incorrect Swift URLs 2017-04-18 19:14:57 +02:00
practicalswift
7eb7d5b109 [gardening] Fix 100 typos. 2017-04-18 17:01:42 +02:00
Max Moiseev
b7f715f7e5 Fixing the iOS test failures 2017-04-17 14:05:34 -07:00
Max Moiseev
54e5f5d741 Handling the differences in << and >> for Swift 3 vs Swift 4
In Swift 3 shifts used to be defined on the concrete integer types, so
the right-hand-side value in the shift expression could define a type
for the result, as in `1 << i32` would have the type Int32. Swift 4
makes shift operators heterogeneous, so now `1 << i32` will result in an
Int, according to the type of the left-hand-side value, which gets a
default type for integer literals.
2017-04-13 15:34:32 -07:00
Max Moiseev
42095bfbaa Merge branch 'master' into new-integer-protocols 2017-04-04 11:00:47 -07:00
Slava Pestov
4ce9094bbe Re-enable a test now that we have a workaround in place 2017-04-03 21:27:05 -07:00
Doug Gregor
74075c1952 [GSB] Don't emit same-type-to-concrete requirements for nested types.
When enumerating same-type-to-concrete requirements, don't emit a
same-type-to-concrete requirement for a nested archetype anchor when
it's parent also is equivalent to a concrete type, because the former
can always be derived from the latter.

Fixes SR-4456 / rdar://problem/31286125.
2017-04-03 13:42:18 -07:00
Max Moiseev
10f0c9e89a Merge branch 'master' into new-integer-protocols 2017-04-03 11:49:56 -07:00
Roman Levenstein
964a6d345e Disable a test to unblock the CI jobs 2017-03-31 14:30:04 -07:00
Max Moiseev
3cbcd716f5 Merge branch 'master' into new-integer-protocols 2017-03-31 10:03:20 -07:00
Roman Levenstein
200bda98e6 Disable the test until rdar://31286125 is fixed. 2017-03-29 16:11:05 -07:00
Roman Levenstein
a05cc2c8b5 Enable simple version of partial specialization by default
The simple version does not allow for partial specialization of generic parameters whose replacement types in a substitution are generic.
2017-03-28 15:56:40 -07:00
Xi Ge
a2a84aa602 Test: re-enable test/Prototypes/PatternMatching.swift (#8343) 2017-03-25 08:58:54 -07:00
Xi Ge
16991905e8 Test: disable test/Prototypes/PatternMatching.swift while we are investigating. rdar://31206521 (#8333) 2017-03-24 19:21:45 -07:00
Max Moiseev
233fb21dd6 multipliedFullWidth(by:) and dividingFullWidth(_:) 2017-03-13 15:16:58 -07:00
Max Moiseev
48b5899c0d WithOverflow => ReportingOverflow 2017-03-13 12:22:36 -07:00
Max Moiseev
ff81681f4f Properly naming bit count properties 2017-03-13 11:50:02 -07:00
Max Moiseev
7d73b2e1ca Arithmetic => Numeric 2017-03-13 11:50:02 -07:00
Max Moiseev
835b8809d2 Merge branch 'master' into new-integer-protocols 2017-03-07 16:18:54 -08:00
Arnold Schwaighofer
429c6515d0 This test case is executable 2017-02-02 13:35:57 -08:00
Max Moiseev
c342166f10 Renaming leadingZeros to leadingZeroBits. Same for trailingZeros 2017-01-30 17:16:16 -08:00
Max Moiseev
0e7863129c Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-30 16:51:16 -08:00
Dave Abrahams
e54fb59101 Fix comment in Algorithms prototype 2017-01-29 16:11:28 -08:00
Nate Cook
7f00cf457f Add BigInt prototype for testing generic integers (#7005)
* [new-integer-protocols] Add BigInt prototype

* Update to use 2s complement for bitwise operations

* Add Bit type and tests using BigInt<Bit>
2017-01-24 15:39:12 -08:00
Max Moiseev
aecccc7e48 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-09 17:38:04 -08:00
Max Moiseev
6a06b667da Fixing some and XFAILing other failing tests 2017-01-06 17:56:20 -08:00
Ben Cohen
3bdada1773 Merge pull request #6506 from airspeedswift/im-not-warning-you-again
[stdlib] Squash various warnings
2017-01-06 16:51:06 -08:00
Max Moiseev
27889c6376 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-06 15:54:44 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00