Re: Where is stringbuilder?
On Thu, 19 Oct 2006 09:12:09 +0200, "Maarten Wiltink"
<maarten@xxxxxxxxxxxxxxxxxx> wrote:
"J French" <erewhon@xxxxxxxxxx> wrote in message
news:4535d495.327324791@xxxxxxxxxxxxxxxxxxx
[...]
For L9 := 1 To L Do
BigStr[ L9 + Start ] := SmallStr[ L9 ] ;
That loop could be replaced by a Move.
True - but to me it would be less legible
Move would probably not be much faster, as although it moves 4 byte
chunks IIRC it assumes that the start position is on a 4 byte boundary
Also it uses : REP MOVSD
- which is a lot more elegant, but very slow
[...]
Personally I don't think that this is worth worrying about unless
one is doing a heck of a lot of concatenations on the same String
ISTR postings here from people who were adding a single character to
a string a mere ten thousand times or so, and wondering why it was
so slow.
I remember such posts vividly
At the risk of starting another code contest, there are _wonderful_
opportunities for premature optimisation in a function that returns
a string containing N instances of character C. And for sufficiently
large N, not even that premature.
'Result:=''; for i:=1 to N do Result:=Result+C;' is _definitely_ the
wrong answer.
Too right !
.
Relevant Pages
- Re: Where is stringbuilder?
... ISTR postings here from people who were adding a single character to ... a string a mere ten thousand times or so, ... opportunities for premature optimisation in a function that returns ... (alt.comp.lang.borland-delphi) - extension_pack
... It is used to set upper loop -- limits for non-deterministic values thus avoiding the use of access -- types and enabling the functions to be used for synthesizeable code. ... DivisorVal: integer) return std_logic_vector; function "/"(DividendVal: string; DivisorVal: integer) return std_logic_vector; ... for loopVar in 0 to slvVal'length/4-1 loop ... end loop; if then return not resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to else return resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to end if; ... (comp.lang.vhdl) - extension_pack
... It is used to set upper loop -- limits for non-deterministic values thus avoiding the use of access -- types and enabling the functions to be used for synthesizeable code. ... DivisorVal: integer) return std_logic_vector; function "/"(DividendVal: string; DivisorVal: integer) return std_logic_vector; ... for loopVar in 0 to slvVal'length/4-1 loop ... end loop; if then return not resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to else return resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to end if; ... (comp.lang.vhdl) - extension_pack
... It is used to set upper loop -- limits for non-deterministic values thus avoiding the use of access -- types and enabling the functions to be used for synthesizeable code. ... DivisorVal: integer) return std_logic_vector; function "/"(DividendVal: string; DivisorVal: integer) return std_logic_vector; ... for loopVar in 0 to slvVal'length/4-1 loop ... end loop; if then return not resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to else return resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to end if; ... (comp.lang.vhdl) - extension_pack
... It is used to set upper loop -- limits for non-deterministic values thus avoiding the use of access -- types and enabling the functions to be used for synthesizeable code. ... DivisorVal: integer) return std_logic_vector; function "/"(DividendVal: string; DivisorVal: integer) return std_logic_vector; ... for loopVar in 0 to slvVal'length/4-1 loop ... end loop; if then return not resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to else return resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to end if; ... (comp.lang.vhdl) |
|