Sorry all should have added..
Have done the split on first field
($tag)=split (/\|/,$data,2);
as well as substr and index stuff
$tag=substr ($data,0,index($data,'\|',));
I then benchmarked them
Benchmark: timing 1000000 iterations of split, substr...
split: 8 wallclock secs ( 6.93 usr + 0.00 sys = 6.93 CPU) @ 14
+4279.32/s(n=1000000)
substr: 1 wallclock secs ( 1.54 usr + 0.00 sys = 1.54 CPU) @ 64
+8088.14/s(n=1000000)
should split be slow compared to substr?
Thinking about what i really want to know monks...
Once i ahve the first field is there a quick way of spliting this field on first space then on an undersocre (if it exsits)?
In my test file I have 5161033 lines, split slows down processing dramatically. When more substr are introduced processing slows down agian!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.