From: Tom Sawyer Date: 2002-07-11T01:40:10+09:00 Subject: Re: String#split converts string args to regexes -- ? matz, Example #1: s = "xyz" * 1000000 a1 = s.split(/y/) Example #2: s = "xyz" * 1000000 a1 = s.split('y') on my system: Example #1: 3.69s cumulative Example #2: 0.73s cumulative ~transami On Wed, 2002-07-10 at 09:24, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: String#split converts string args to regexes -- ?" > on 02/07/10, Tom Sawyer writes: > > |and, if implemented without regexps, could easily boost performance, > |which IMHO is an important bonus considering speed is probably the > |primary site against ruby in comparison to perl and python. > > regex is highly optimized for searching. search using regex > (e.g. str.index(/pat/)) is almost always faster than search using > strings (e.g. str.index("pat")). > > matz. > -- ~transami "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -- Benjamin Franklin