You could also take a look at JudyDicts.jl, which wrap the corresponding C
library. Supposedly, it's one of the most highly optimized Dict
implementations anywhere. I think the Julia package may need an update,
however.
https://github.com/tanmaykm/JudyDicts.jl
-Jacob
On Mon, May 18, 2015 at
On Mon, May 18, 2015 at 5:24 PM, Scott Jones scott.paul.jo...@gmail.com wrote:
I suppose I could use a set simply to determine if it was present or not,
and then push! to another array if not present... just didn't seem as
efficient as what I'm used to...
Why does it have to be an array? And
Scott, this looks pretty much exactly like what Tim's example does: you have a
dictionary (aka associative array, aka mapping, depending on your terminology)
mapping keys to a counter.
Dicts are reasonably fast in Julia, although they could certainly be further
optimized (like almost
use a Set?
http://docs.julialang.org/en/latest/stdlib/collections/?highlight=set
On Mon, May 18, 2015 at 4:46 PM Scott Jones scott.paul.jo...@gmail.com
wrote:
I would like to be able to do the following in Julia:
Take a UInt64 (or UInt128, for that matter), and add it to an array, if it
is
How well do Dict’s perform currently in Julia? I hope pretty well! Thanks,
that’s more what I needed…
-Scott
On May 18, 2015, at 5:34 PM, Tim Holy tim.h...@gmail.com wrote:
If you really want to get the index back, perhaps better might be a dict:
counter = 0
d = Dict{KeyType,Int}()
As long as the dict is concretely typed, it should be pretty good. (I can't
comment about string keys, but you probably could! I think Symbols are more
performant than strings for indexing.)
Also, small correction: I should have used get! instead of get. You want to
set that new value in the
I suppose I could use a set simply to determine if it was present or not,
and then push! to another array if not present... just didn't seem as
efficient as what I'm used to...
On Monday, May 18, 2015 at 4:53:02 PM UTC-4, Jameson wrote:
use a Set?
I would like to be able to do the following in Julia:
Take a UInt64 (or UInt128, for that matter), and add it to an array, if it
is not already present, returning the index.
(This would be trivial in the language I used to work on, and I think it
probably is in Julia as well, but I haven't found
On Monday, May 18, 2015 at 5:31:18 PM UTC-4, Yichao Yu wrote:
On Mon, May 18, 2015 at 5:24 PM, Scott Jones scott.pa...@gmail.com
javascript: wrote:
I suppose I could use a set simply to determine if it was present or
not,
and then push! to another array if not present... just didn't
On Monday, May 18, 2015 at 6:26:06 PM UTC-4, Jacob Quinn wrote:
You could also take a look at JudyDicts.jl, which wrap the corresponding C
library. Supposedly, it's one of the most highly optimized Dict
implementations anywhere. I think the Julia package may need an update,
however.
If you really want to get the index back, perhaps better might be a dict:
counter = 0
d = Dict{KeyType,Int}()
for item in list
idx = get(d, item, counter+1)
if idx counter
counter += 1
end
# Do whatever you plan to do with idx
end
--Tim
On Monday, May 18, 2015 02:24:25
Oops... that should have been:
If '$data(arr(key),index) { // If the array already has the key, it is set
into the variable index, otherwise:
Set index = $Increment(arr) // atomically increment index, and set the
key to that value in the array
Set arr(key) = index
Set index(index) =
12 matches
Mail list logo