Skip to content

Instantly share code, notes, and snippets.

View ScottPJones's full-sized avatar

Scott P. Jones ScottPJones

  • Gandalf Software, Inc.
  • Beverly, MA USA
View GitHub Profile
@ScottPJones
ScottPJones / Results from v"0.3.7"
Last active August 29, 2015 14:20
Benchmark v"0.3.7" vs v"0.4" vs v"0.4" with my conversion,length,validation changes
julia> VERSION
v"0.3.7"
julia> dotest(1000,true)
ASCII: Looping 1000 times, length=8
length: elapsed time: 7.674e-6 seconds (0 bytes allocated)
is_valid_ascii: elapsed time: 2.1853e-5 seconds (0 bytes allocated)
Convert to UTF-8: elapsed time: 1.2325e-5 seconds (16000 bytes allocated)
Convert to UTF-16:elapsed time: 0.000314615 seconds (144000 bytes allocated)
@ScottPJones
ScottPJones / Benchmark
Created May 11, 2015 16:07
Test C vs Julia length code
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.4.0-dev+4600 (2015-05-02 21:32 UTC)
_/ |\__'_|_|_|\__'_| | spj/u16_charlen/0dad086* (fork: 1 commits, 0 days)
|__/ | x86_64-apple-darwin14.3.0
julia> include("/d/spj/perftest.jl")
""
@ScottPJones
ScottPJones / Timeoutput
Created May 14, 2015 09:13
New time macro results
ulia> @time for i=1:1000
x = utf16("this is a test\u80\uff\u7ff\uffff\U10ffff")
end
140.447 microseconds (2000 allocations: 44925 KB)
julia> @time for i=1:10
x = utf16("this is a test\u80\uff\u7ff\uffff\U10ffff")
end
5.457 microseconds (20 allocations: 44801 KB)
@ScottPJones
ScottPJones / Results with generic methods
Created May 21, 2015 23:59
Results from #11004 using more generic methods
julia> @timev dotest(1000,true)
ASCII: Looping 1000 times, length=8
length: 6.128 microseconds
is_valid_ascii: 16.227 microseconds
Convert to UTF-8: 18.801 microseconds (1000 allocations: 16000 bytes)
Convert to UTF-16: 123.615 microseconds (2000 allocations: 109 KB)
Convert to UTF-32: 128.039 microseconds (2000 allocations: 125 KB)
@ScottPJones
ScottPJones / chkutf.jl
Created May 23, 2015 22:57
Test generic vs. separate methods to check UTF-16/UTF-32/AbstractString
# This file is a part of Julia. License is MIT: http://julialang.org/license
module CheckUTF
if VERSION < v"0.4-"
typealias AbstractString String
typealias UInt Uint
typealias UInt8 Uint8
typealias UInt16 Uint16
typealias UInt32 Uint32
end
@ScottPJones
ScottPJones / Results-05-25-0.4
Created May 25, 2015 21:06
Results from 0.4 master (May 25th)
ASCII: Looping 100 times, length=8
length: 1.316 microseconds
is_valid_ascii: 22.529 milliseconds (5600 allocations: 62722 KB, 31.40% gc time)
Convert to UTF-8: 1.527 microseconds (100 allocations: 1600 bytes)
Convert to UTF-16: 16.616 microseconds (500 allocations: 17600 bytes)
Convert to UTF-32: 9.947 microseconds (200 allocations: 12800 bytes)
ASCII:: Looping 100 times, length=8
UTF-8: 8, UTF-16: 16, UTF-32: 32
@ScottPJones
ScottPJones / Results-05-25-0.4-11004
Created May 25, 2015 21:10
Benchmark results with #11004 PR (May 25th)
ASCII: Looping 100 times, length=8
length: 1.295 microseconds
is_valid_ascii: 25.904 milliseconds (5600 allocations: 62722 KB, 40.59% gc time)
Convert to UTF-8: 985 nanoseconds (100 allocations: 1600 bytes)
Convert to UTF-16: 8.212 microseconds (200 allocations: 11200 bytes)
Convert to UTF-32: 10.364 microseconds (200 allocations: 12800 bytes)
ASCII:: Looping 100 times, length=8
UTF-8: 8, UTF-16: 16, UTF-32: 32
@ScottPJones
ScottPJones / perftest.jl
Created May 25, 2015 21:17
Benchmark test of length, validation, convert
VERSION < v"0.4-" && (typealias AbstractString String)
function tst{T <: AbstractString}(str::T, max::Int)
local l
for i=1:max
l = length(str)
end
l
end
function cvt8{T <: AbstractString}(str::T, max::Int)
local out
@ScottPJones
ScottPJones / testcvt.jl
Last active August 29, 2015 14:21
Tests for string conversions
# issue #11004 (#10959)
module TestConvert
global counttest = 0
global counterr = 0
incrtest() = (global counttest += 1)
increrr() = (global counterr += 1)
@ScottPJones
ScottPJones / 11551-inbounds
Created June 3, 2015 08:27
Latest results, with @inbounds
ASCII: Looping 1000 times, length=8
length: 2.715 microseconds
is_valid_ascii: 150.964 milliseconds (56000 allocations: 613 MB, 10.07% gc time)
Convert to UTF-8: 19.096 microseconds (1000 allocations: 16000 bytes)
Convert to UTF-16: 85.436 microseconds (2000 allocations: 109 KB)
Convert to UTF-32: 95.890 microseconds (2000 allocations: 125 KB)
ASCII:: Looping 1000 times, length=8
UTF-8: 8, UTF-16: 16, UTF-32: 32