On 6 Nov 2017, at 17:21, Kelvin Ma via swift-users
wrote:
> doesn’t the compiler like to optimize the loop out of the benchmarking code?
Yep. I would resolve this by reading the input from a file. For example, in
the data-to-String case, you could:
1. Read lots of
doesn’t the compiler like to optimize the loop out of the benchmarking
code? i’ve always had a hard time writing benchmarks in Swift
On Fri, Nov 3, 2017 at 7:10 PM, Ryan Walklin via swift-users <
swift-users@swift.org> wrote:
> Why not just profile it? Set up a loop of 100,000 or so with each
On 3 Nov 2017, at 19:42, Jens Alfke via swift-users
wrote:
> Any way to pass the bytes directly to String without an intermediate copy?
You can do this with `UnsafeBufferPointer`. For example:
extension String {
init?(bytes: UnsafePointer, count: Int) {
Why not just profile it? Set up a loop of 100,000 or so with each method and
time it.
Ryan
> On 4 Nov 2017, at 6:42 am, Jens Alfke via swift-users
> wrote:
>
> I’m working with a C API that represents strings as UTF-8 data tagged with a
> length but **without a