JC

Thanks for the example -- I'm sure I can construct the equivalent C++
code, and if not I'll look through the tests that I'm sure contain some
examples.

You mentioned that blocked views are advantageous for when you have lots
of small strings. The advantages are better reuse of space and more
compact storage? What other circumstances would benefit from using blocked
views? Is there a (significant) performance penalty using blocked views?

Specifically, does it make sense to convert these views to blocked (these
come from my schema for e4Graph):

#define MK4_GRAPHSTRINGS1_5     "e4GraphStrings[s:S,next:I,flags:I]"
#define MK4_GRAPHNAMES1_5       "e4GraphNames[n:S,next:I,flags:I]"
#define MK4_GRAPHBINARY1_5      "e4GraphBinary[b:B,next:I,flags:I]"

If so, the equivalent blocked ones would be:

#define MK4_GRAPHSTRINGS1_5     "e4GraphStrings[_B[s:S,next:I,flags:I]]"
#define MK4_GRAPHNAMES1_5       "e4GraphNames[_B[n:S,next:I,flags:I]]"
#define MK4_GRAPHBINARY1_5      "e4GraphBinary[_B[b:B,next:I,flags:I]]"

and then instead of getting them from the storage with (note, this is C++
code):

        strings = storage->GetAs(MK4_GRAPHSTRINGS1_5);
        binary = storage->GetAs(MK4_GRAPHBINARY1_5);
        names = storage->GetAs(MK4_GRAPHNAMES1_5);

I'd do:

        strings = storage->GetAs(MK4_GRAPHSTRINGS1_5).blocked();
        binary = storage->GetAs(MK4_GRAPHBINARY1_5).blocked();
        names = storage->GetAs(MK4_GRAPHNAMES1_5).blocked();

and use as before?

--JYL

> Rick King wrote:
>
>> Could someone give me a quick explanation of "blocked" views? The HTML
>>  help
>> is way too sketchy for me. Or at least point me to another resource
>> where I
>> might get a better explanation?
>
> You want a Python example, presumably.
>
> I see that there are none in Python the examples/ dir in the source
> distro, and Brian Kelley's updated docs at
> http://jura.wi.mit.edu/people/kelley/tutorial/python.html hasn't
> covered it yet either.
>
> I'll use plain English, and let others come up with accurate Python:
>
> * instead of defining a view "blah[a:I,b:S,c:D]", define
>       blah[_B[a:I,b:S,c:D]]
> * in other words, don't define a view of rows, but a view of views of
> rows
> * when you open the view, replace:
>       view = storage.view("blah")
>    with
>       view = storage.view("blah").blocked()
> * or you can use getas, just make sure the structure is as above
> * in other words, don't just use the raw view but pass it through
> blocked()
> * that's it
>
> You cannot mix things.  When blocked, never access the unblocked view.
>
> You cannot convert data as is, the only way to do so is to copy all
> data in.  In C++ there is a call to insert one view into another
> (compatible) one, but I think in Python you'll have to copy row by row.
>
> -jcw
>
> _____________________________________________
> Metakit mailing list  -  [EMAIL PROTECTED]
> http://www.equi4.com/mailman/listinfo/metakit



_____________________________________________
Metakit mailing list  -  [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit

Reply via email to