Sha256: c013596707f02c77818befb272627b986fb6fc718f0d11a28948822fc2943ade
Contents?: true
Size: 629 Bytes
Versions: 10
Compression:
Stored size: 629 Bytes
Contents
require_relative './shared' str = 'Lorem ipsum et dolorem' rx = /\s/ cs = CharacterSet.whitespace benchmark( caption: 'Removing whitespace', cases: { 'String#gsub' => -> { str.gsub(rx, '') }, 'CharacterSet#delete_in' => -> { cs.delete_in(str) }, } ) str = 'Lörem ipsüm ⛷ et dölörem' rx = /[\s\p{emoji}äüö]/ cs = CharacterSet.whitespace + CharacterSet.emoji + CS['ä', 'ü', 'ö'] benchmark( caption: 'Removing whitespace, emoji and umlauts', cases: { 'String#gsub' => -> { str.gsub(rx, '') }, 'CharacterSet#delete_in' => -> { cs.delete_in(str) }, } )
Version data entries
10 entries across 10 versions & 1 rubygems