Wednesday, October 26, 2016

My current traverse, I can make it an in place generator

# descend from the top and collect G_index going down
 def traverse(self,id,fun,arglist=None) :
 # self anchors multiple blocks, get the last index for elements covered by self
  end = id + self.count 
  if fun(self,id,arglist) != CONTINUE : return(end) 
  
  # go through each of the comma separated blocks
  id = id + 1 # skip the anchor
  while id  < end  and (self.return_val == CONTINUE) :
   id = G.GET(id).traverse(id,fun,arglist) # here it gets the actual node from the array
  if self.return_val == BLOCK : self.return_val = CONTINUE
  return(end)

Descends a nested block sequence. See that line where the comment says "skip the anchor".  That means its jumping the dot and doing comas as in:

graph = a.(b,c)

This is beginning computer stuff, sure, but there is a point. If you have a bunch of singletons,no compound blocks, then is two lines of code and you exit this routing. It is almost like a scan of the linear array. Right now, on the enter side, I have block moves going on like bananas, and there is where the focus is. o I don't want a flexible graph, I want something like this, that is maintained in a way it can be perfectly protected even while supporting million of node scans a second on large graphs.  

At the site, we have probability counters that run the graph for the site owner, and hey schedule a rebalance.  We want that rebalance bot to efficiently walk the graph even while it and million of other bots pour through it.  But it is exactly those moments when the traders know something that is not yet priced,  That's the surprise, the innovation, that is when everyone wants to be running the graph, and also when the graph needs the most rebalancing. If I can make that work, I am rich, I ell you, filthy rich. Why I might even start acting some dumbfounded Silicon Valley geek.

But, look how short and contained.  Why bother with calls, just generate the code sequence whenever the software wants a traverse.  I am not in a hurry, until I et a full simulator,  I know this lap top can do it, it is an old used proton smasher. 

How much code, really?
Been there, done that. Under the right conditions, I could hand code that into less than a hundred micro-instructions, deliver a binary set of bits that is a graph engine for millions of transactions.  But it is egads! on insert, delete, and replace; a small nightmare.

No comments: