On Thu, 15 Mar 2012 22:16:18 -0400, Kevin kevincox...@gmail.com wrote:
This is in no way D specific but say you have two constant strings.
const char[] a = 1234567890;
// and
const char[] b = 67890;
You could lay out the memory inside of one another. IE: if a.ptr = 1
then b.ptr = 6. I'm
On Fri, 16 Mar 2012 13:16:18 +1100, Kevin kevincox...@gmail.com wrote:
This is in no way D specific but say you have two constant strings.
const char[] a = 1234567890;
// and
const char[] b = 67890;
You could lay out the memory inside of one another. IE: if a.ptr = 1
then b.ptr = 6. I'm
On 03/19/2012 01:33 PM, Derek wrote:
On Fri, 16 Mar 2012 13:16:18 +1100, Kevin kevincox...@gmail.com wrote:
This is in no way D specific but say you have two constant strings.
const char[] a = 1234567890;
// and
const char[] b = 67890;
You could lay out the memory inside of one another. IE:
On Tue, Mar 20, 2012 at 12:05:55AM +0100, Timon Gehr wrote:
On 03/19/2012 01:33 PM, Derek wrote:
On Fri, 16 Mar 2012 13:16:18 +1100, Kevin kevincox...@gmail.com wrote:
This is in no way D specific but say you have two constant strings.
const char[] a = 1234567890;
// and
const char[] b =
On 20 March 2012 01:33, Derek ddparn...@bigpond.com wrote:
Is the effort to do this really an issue with today's vast amounts of RAM
(virtual and real) available? How much memory are you expecting to 'save'?
And is RAM address alignment an issue here also? Currently most literals are
aligned
On Tue, Mar 20, 2012 at 12:55:29PM +1300, James Miller wrote:
On 20 March 2012 01:33, Derek ddparn...@bigpond.com wrote:
Is the effort to do this really an issue with today's vast amounts
of RAM (virtual and real) available? How much memory are you
expecting to 'save'?
And is RAM
On 20 March 2012 13:17, H. S. Teoh hst...@quickfur.ath.cx wrote:
Sites should be blazingly fast with today's computing power, but a
ridiculous focus on Developer productivity has meant that no change
has happened.
Exactly! In spite of the fact that CPU speed has increased on the order
of a
On Friday, 16 March 2012 at 11:41:59 UTC, Alex Rønne Petersen
wrote:
On 16-03-2012 12:32, Peter Alexander wrote:
On Friday, 16 March 2012 at 02:31:47 UTC, Xinok wrote:
On Friday, 16 March 2012 at 02:18:27 UTC, Kevin wrote:
This is in no way D specific but say you have two constant
strings.
On Mar 18, 2012 4:50 PM, Peter Alexander peter.alexander...@gmail.com
wrote:
Neither do I, but it's more work for the compiler, and even if the
compiler does string pooling, it may not look for common suffixes.
It would be more work but it would have memory and cache benefits. If you
stored
On 16/03/12 13:24, Kevin Cox wrote:
On Mar 16, 2012 7:45 AM, Alex Rønne Petersen xtzgzo...@gmail.com
mailto:xtzgzo...@gmail.com wrote
I don't see any reason why c couldn't point to element number 3 of b,
and have its length set to 3...
--
- Alex
And the previous examples were
On Friday, 16 March 2012 at 02:31:47 UTC, Xinok wrote:
On Friday, 16 March 2012 at 02:18:27 UTC, Kevin wrote:
This is in no way D specific but say you have two constant
strings.
const char[] a = 1234567890;
// and
const char[] b = 67890;
You could lay out the memory inside of one another.
On 16-03-2012 12:32, Peter Alexander wrote:
On Friday, 16 March 2012 at 02:31:47 UTC, Xinok wrote:
On Friday, 16 March 2012 at 02:18:27 UTC, Kevin wrote:
This is in no way D specific but say you have two constant strings.
const char[] a = 1234567890;
// and
const char[] b = 67890;
You could
On Mar 16, 2012 7:45 AM, Alex Rønne Petersen xtzgzo...@gmail.com wrote
I don't see any reason why c couldn't point to element number 3 of b, and
have its length set to 3...
--
- Alex
And the previous examples were language agnostic. In D and other languages
where the length of a string is
On Fri, Mar 16, 2012 at 08:24:34AM -0400, Kevin Cox wrote:
[...]
And the previous examples were language agnostic. In D and other
languages where the length of a string is stored we can nest strings
anywhere inside other strings.
const char[] a = foofoo;
const char[] b = oof;
Those
On Friday, 16 March 2012 at 12:24:45 UTC, Kevin Cox wrote:
On Mar 16, 2012 7:45 AM, Alex Rønne Petersen
xtzgzo...@gmail.com wrote
I don't see any reason why c couldn't point to element number
3 of b, and
have its length set to 3...
--
- Alex
And the previous examples were language
On 03/16/2012 03:28 PM, H. S. Teoh wrote:
On Fri, Mar 16, 2012 at 08:24:34AM -0400, Kevin Cox wrote:
[...]
And the previous examples were language agnostic. In D and other
languages where the length of a string is stored we can nest strings
anywhere inside other strings.
const char[] a =
On Friday, 16 March 2012 at 15:41:32 UTC, Timon Gehr wrote:
On 03/16/2012 03:28 PM, H. S. Teoh wrote:
More to the point, does dmd perform this optimization
currently?
T
No.
immutable string a = 123;
immutable string b = a;
void main(){writeln(a.ptr is b.ptr);} // false
It actually
On Friday, 16 March 2012 at 18:44:53 UTC, Xinok wrote:
On Friday, 16 March 2012 at 15:41:32 UTC, Timon Gehr wrote:
On 03/16/2012 03:28 PM, H. S. Teoh wrote:
More to the point, does dmd perform this optimization
currently?
T
No.
immutable string a = 123;
immutable string b = a;
void
On Friday, 16 March 2012 at 18:44:53 UTC, Xinok wrote:
It actually does, but only identical strings. It doesn't seem
to do strings within strings.
Don't forget that 123 is /not/ a substring of 123456
because of the invisible 0 terminator (which is there
for easy compatibility with C
On 03/16/2012 07:52 PM, Xinok wrote:
On Friday, 16 March 2012 at 18:44:53 UTC, Xinok wrote:
On Friday, 16 March 2012 at 15:41:32 UTC, Timon Gehr wrote:
On 03/16/2012 03:28 PM, H. S. Teoh wrote:
More to the point, does dmd perform this optimization currently?
T
No.
immutable string a =
On Friday, 16 March 2012 at 18:56:00 UTC, Timon Gehr wrote:
It can't because there must be a terminating zero byte. It does
not do it even if it could though.
immutable string x = 123;
immutable string y = 123;
void foo(string a){
string b = 123;
writeln(a is b);
}
void
This is in no way D specific but say you have two constant strings.
const char[] a = 1234567890;
// and
const char[] b = 67890;
You could lay out the memory inside of one another. IE: if a.ptr = 1
then b.ptr = 6. I'm not sure if this has been done and I don't think it
would apply very often
On Friday, 16 March 2012 at 02:18:27 UTC, Kevin wrote:
This is in no way D specific but say you have two constant
strings.
const char[] a = 1234567890;
// and
const char[] b = 67890;
You could lay out the memory inside of one another. IE: if
a.ptr = 1 then b.ptr = 6. I'm not sure if this
On 16-03-2012 03:31, Xinok wrote:
On Friday, 16 March 2012 at 02:18:27 UTC, Kevin wrote:
This is in no way D specific but say you have two constant strings.
const char[] a = 1234567890;
// and
const char[] b = 67890;
You could lay out the memory inside of one another. IE: if a.ptr = 1
then
On 03/15/2012 10:35 PM, Alex Rønne Petersen wrote:
On 16-03-2012 03:31, Xinok wrote:
I'm pretty sure this is called string pooling.
Right. Most compilers do it.
Cool. You learn something every day.
25 matches
Mail list logo