Re: Performance question with a string concat
Simon von Janowsky <mail@xxxxxxxxxx> wrote:
> Hello,
> I want to let grow a string variable within a loop.
> A non-interpolated string '' is said to be faster than the usual ""
> string. Disadvantage of the non-interpolated string is that \n is not
> recognized.
>
> Now, what would be faster?
>
> a.)
> my $out;
> for (my $c = 0; c < 100; c++)
> {
> $out .= "variable=\"value\" \n";
> }
>
> oder b.)
> my $out;
> for (my $c = 0; c < 100; c++)
> {
> $out .= 'variable="value"' . "\n";
> }
Those seem to compile down to the same thing (except that one has
a space before the \n and the other doesn't) so they should have the same
speed.
>
> And what if interpolation is needed?
Try it and see.
Xho
--
--------------------
http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
.
Relevant Pages
- 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) - Re: Letter to US Sen. Byron Dorgan re unpaid overtime
... The MAXIMUM size of a working string, accessed in its entirety, is ... compiler would generate a loop), ... > natural incompetence in the field of programming. ... (comp.programming) |
|