Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #23804 > unrolled thread
| Started by | jonas.thornvall@gmail.com |
|---|---|
| First post | 2014-04-06 21:58 -0700 |
| Last post | 2014-04-07 16:22 +0000 |
| Articles | 9 — 6 participants |
Back to article view | Back to comp.lang.javascript
Boolean spacerequirment in javascript jonas.thornvall@gmail.com - 2014-04-06 21:58 -0700
Re: Boolean spacerequirment in javascript jonas.thornvall@gmail.com - 2014-04-06 22:10 -0700
Re: Boolean spacerequirment in javascript "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-04-07 00:42 -0700
Re: Boolean spacerequirment in javascript jonas.thornvall@gmail.com - 2014-04-07 01:23 -0700
Re: Boolean spacerequirment in javascript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-04-07 13:40 +0200
Re: Boolean spacerequirment in javascript Christoph Michael Becker <cmbecker69@arcor.de> - 2014-04-07 13:52 +0200
Re: Boolean spacerequirment in javascript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-04-07 14:15 +0200
Re: Boolean spacerequirment in javascript Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-04-07 15:11 +0200
Re: Boolean spacerequirment in javascript Tim Streater <timstreater@greenbee.net> - 2014-04-07 16:22 +0000
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2014-04-06 21:58 -0700 |
| Subject | Boolean spacerequirment in javascript |
| Message-ID | <3f966da1-6f24-44bb-8f1e-ef833896693c@googlegroups.com> |
I have a datastructure "array" over a user defined range, where i store information about natural numbers.
Right now i basicly store the actual number, and if it is a prime and how it will be presented.
Other properties like if the number is square, cubic in fibonaci i generate on the fly since it is not as heavy as calculate the primes.
However i am thinking about moving these into the datastructure, but since the script can generate and store 10 000 000 objects/elements indexed i hesitate. Because i do not know how the extra memory requirements storing the bolean properties.
This is my datastructure and initialization right now.
How much space would it take if i added fibonaci,square and cubic booleans into the structure if the scope is one million elements/objects?
Would it save alot of space (and time?) if i stored colors as integers and used a lookup table at printout setting the color?
function arraysize()
{
for ( i = -scope; i <= scope; i ++ )
{
arr[i] =
{
count : i,
fcolor : 'black',
rheight : 100,
rwidth : 100,
rcolor : 'white',
prime : true
}
}
}
[toc] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2014-04-06 22:10 -0700 |
| Message-ID | <82f28e46-6a35-4353-a18a-9cac95c3ed60@googlegroups.com> |
| In reply to | #23804 |
Den måndagen den 7:e april 2014 kl. 06:58:28 UTC+2 skrev jonas.t...@gmail.com:
> I have a datastructure "array" over a user defined range, where i store information about natural numbers.
>
>
>
> Right now i basicly store the actual number, and if it is a prime and how it will be presented.
>
>
>
> Other properties like if the number is square, cubic in fibonaci i generate on the fly since it is not as heavy as calculate the primes.
>
>
>
> However i am thinking about moving these into the datastructure, but since the script can generate and store 10 000 000 objects/elements indexed i hesitate. Because i do not know how the extra memory requirements storing the bolean properties.
>
>
>
> This is my datastructure and initialization right now.
>
> How much space would it take if i added fibonaci,square and cubic booleans into the structure if the scope is one million elements/objects?
>
>
>
> Would it save alot of space (and time?) if i stored colors as integers and used a lookup table at printout setting the color?
>
>
>
> function arraysize()
>
> {
>
>
>
> for ( i = -scope; i <= scope; i ++ )
>
> {
>
> arr[i] =
>
> {
>
> count : i,
>
> fcolor : 'black',
>
> rheight : 100,
>
> rwidth : 100,
>
> rcolor : 'white',
>
> prime : true
>
> }
>
> }
>
> }
http://web.comhem.se/jonasth/prime0.993/div.html
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2014-04-07 00:42 -0700 |
| Message-ID | <1d16e75b-1801-4de7-a123-6b4d0528a36b@googlegroups.com> |
| In reply to | #23804 |
On Sunday, April 6, 2014 11:58:28 PM UTC-5, jonas.t...@gmail.com wrote:
> I have a datastructure "array" over a user defined range, where i store information about natural numbers.
>
> Right now i basicly store the actual number, and if it is a prime and how it will be presented.
>
> Other properties like if the number is square, cubic in fibonaci i generate on the fly since it is not as heavy as calculate the primes.
>
> However i am thinking about moving these into the datastructure, but since the script can generate and store 10 000 000 objects/elements indexed i hesitate. Because i do not know how the extra memory requirements storing the bolean properties.
>
> This is my datastructure and initialization right now.
>
> How much space would it take if i added fibonaci,square and cubic booleans into the structure if the scope is one million elements/objects?
>
> Would it save alot of space (and time?) if i stored colors as integers and used a lookup table at printout setting the color?
>
> function arraysize()
> {
> for ( i = -scope; i <= scope; i ++ )
> {
> arr[i] =
> {
> count : i,
> fcolor : 'black',
> rheight : 100,
> rwidth : 100,
> rcolor : 'white',
> prime : true
> }
> }
> }
Since the index of the array is the same as the count, do you need to have the property at all? Also, if the display properties are constant for this range, you could have a shared reference:
function arraysize(){
var display = {
fcolor : 'black',
rheight : 100,
rwidth : 100,
rcolor : 'white'
};
for (var i = -scope; i <= scope; i++)
arr[i] = {
prime : true,
display: display
}
}
Are you using the properties of the numbers only to dictate how they will be displayed?
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2014-04-07 01:23 -0700 |
| Message-ID | <37549a11-46c2-49fd-abcd-e94bc6a18429@googlegroups.com> |
| In reply to | #23807 |
Den måndagen den 7:e april 2014 kl. 09:42:19 UTC+2 skrev Michael Haufe (TNO):
> On Sunday, April 6, 2014 11:58:28 PM UTC-5, jonas.t...@gmail.com wrote:
>
> > I have a datastructure "array" over a user defined range, where i store information about natural numbers.
>
> >
>
> > Right now i basicly store the actual number, and if it is a prime and how it will be presented.
>
> >
>
> > Other properties like if the number is square, cubic in fibonaci i generate on the fly since it is not as heavy as calculate the primes.
>
> >
>
> > However i am thinking about moving these into the datastructure, but since the script can generate and store 10 000 000 objects/elements indexed i hesitate. Because i do not know how the extra memory requirements storing the bolean properties.
>
> >
>
> > This is my datastructure and initialization right now.
>
> >
>
> > How much space would it take if i added fibonaci,square and cubic booleans into the structure if the scope is one million elements/objects?
>
> >
>
> > Would it save alot of space (and time?) if i stored colors as integers and used a lookup table at printout setting the color?
>
> >
>
> > function arraysize()
>
> > {
>
> > for ( i = -scope; i <= scope; i ++ )
>
> > {
>
> > arr[i] =
>
> > {
>
> > count : i,
>
> > fcolor : 'black',
>
> > rheight : 100,
>
> > rwidth : 100,
>
> > rcolor : 'white',
>
> > prime : true
>
> > }
>
> > }
>
> > }
>
>
>
> Since the index of the array is the same as the count, do you need to have the property at all? Also, if the display properties are constant for this range, you could have a shared reference:
>
>
>
> function arraysize(){
>
> var display = {
>
> fcolor : 'black',
>
> rheight : 100,
>
> rwidth : 100,
>
> rcolor : 'white'
>
> };
>
>
>
> for (var i = -scope; i <= scope; i++)
>
> arr[i] = {
>
> prime : true,
>
> display: display
>
> }
>
> }
>
>
>
> Are you using the properties of the numbers only to dictate how they will be displayed?
I think i will need the counter doing filter manipulations to print out subsets.
Otherwise i have to create another array to store the filtered subset.
Well width and height should probably not be there since the objects printed out are same size, but i do need rcolor and fcolor for each object, the rendering is layered, (sequential order) and i basicly go from most frequent to smallest frequent meaning that at user update of printout properties i actually must loop through all generating functions except for prime which is prestored and only need to be set.
If i add booleans for all properties i can remove the colorfield and set colors using a lookup table at printout but i am not sure what that does speedwise when running animate.
And i read that javascript may store 32 bit for each boolean value?
Right now the properties of the numbers only used to store colors, so the color field store odd,even,pos,neg,prime, square, cube and fibonacci in sequential order painting over previous stored value.
But i can see now that the chosen height and width probably should be set hardcoded by variable not in object.
But i will keep count for filtering at object level not in the loop and probably add a boolean called render.
But whether setting boolean properties or render square,cubic,fibonaci on the fly i am not sure, which is more fast or elegant. Because there could be other properties or sequenses needed to be added and the object grow out of memory.
but since i actually do not store each instance of the square, fibonaci and cubic numbers bu
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2014-04-07 13:40 +0200 |
| Message-ID | <XnsA3088B25DE64Eeejj99@194.109.133.133> |
| In reply to | #23808 |
jonas.thornvall@gmail.com wrote on 07 apr 2014 in comp.lang.javascript: > And i read that javascript may store 32 bit for each boolean value? NO! A boolean value has only 1 [one] bit. That bit, ofcourse can have two states. ================================ Do you perhaps mean binary value? Javascript stores no binary values, just integer numeric values and floating point values. That the inner working of the engine is usually binary in nature should nt concern you, since it is only the effects, like largest ans smallest integer, and floating point resolution inconsistancies, that interact with the programmer. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Christoph Michael Becker <cmbecker69@arcor.de> |
|---|---|
| Date | 2014-04-07 13:52 +0200 |
| Message-ID | <53429177$0$6699$9b4e6d93@newsspool2.arcor-online.net> |
| In reply to | #23809 |
Evertjan. wrote: > jonas.thornvall@gmail.com wrote on 07 apr 2014 in comp.lang.javascript: > >> And i read that javascript may store 32 bit for each boolean value? > > NO! > > A boolean value has only 1 [one] bit. But may well use a full memory word for storage. -- Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2014-04-07 14:15 +0200 |
| Message-ID | <XnsA3089106D78EAeejj99@194.109.133.133> |
| In reply to | #23811 |
Christoph Michael Becker <cmbecker69@arcor.de> wrote on 07 apr 2014 in comp.lang.javascript: >> A boolean value has only 1 [one] bit. > > But may well use a full memory word for storage. Indeed, but that could be engine dependent. You could store 32 boolean values in every numeric location, however. Perhaps a string of 32bit characters would be even more memory wise and programmer or cpu time stupid? Every Bond having his own Moneypenny. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2014-04-07 15:11 +0200 |
| Message-ID | <2806802.YhYcYyqj6s@PointedEars.de> |
| In reply to | #23811 |
Christoph Michael Becker wrote:
> Evertjan. wrote:
>> jonas.thornvall@gmail.com wrote on 07 apr 2014 in comp.lang.javascript:
>>> And i read that javascript may store 32 bit for each boolean value?
>>
>> NO!
>>
>> A boolean value has only 1 [one] bit.
>
> But may well use a full memory word for storage.
Exactly. Given that there is no “javascript” programming language, no
single language, and none at all; but (nowadays) only various different
implementations of the same standard – the ECMAScript Language Specification
(which for very good reason does not say anything about how to *store*
values to begin with); but not necessarily the same Edition of it, and not
necessarily fully defined by it –, the "question" and the "discussion" are
completely bogus.
Before thinking about what a programming language "is", "does", "can" or
"cannot", "could" or "could not" do – really, before *any* reasoning –, one
should get one’s facts right. Otherwise one will ever proceed from false
premises – /ex falso quodlibet/ – and then, as one rather famous Scotsman
wrote, “insensibly one begins to twist facts to suit theories, instead of
theories to suit facts.” [1]
The most important fact here is:
There is no javascript.
See <http://PointedEars.de/es-matrix> for details.
(I know that you, Christoph, know this already.)
_________
[1] DOYLE, A.C.: A Scandal in Bohemia; in: “The Adventures of Sherlock
Holmes”. George Newnes Ltd., London, 1892. (First published in: “The
Strand Magazine”, London, 1891.)
--
PointedEars
Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2014-04-07 16:22 +0000 |
| Message-ID | <070420141622579349%timstreater@greenbee.net> |
| In reply to | #23813 |
In article <2806802.YhYcYyqj6s@PointedEars.de>, Thomas 'PointedEars' Lahn <PointedEars@web.de> wrote: > The most important fact here is: > > There is no javascript. No, this is the most trivially unimportant "fact" here. But you are too stupid to understand that. -- "If you're not able to ask questions and deal with the answers without feeling that someone has called your intelligence or competence into question, don't ask questions on Usenet where the answers won't be carefully tailored to avoid tripping your hair-trigger insecurities." - D M Procida, UCSM
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web