Hi Peter,
Great reply. You helped my understanding of the way ref-counting functions
with respect to c-objects a lot. The concept of the memory heap has only
mattered to me peripherally and so ref-counting was a similarly hazy idea.
The result of mainly dealing in 4GL languages. Anyway now I get that the
objects all exist physically in the same memory heap with the references to
them being dependent on the scope the reference is created in. Nice.

On Mon, Jul 24, 2017 at 11:29 PM, Peter Bozek via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> >  ​
> > SET($1->;"name";"Kirk")
> >
> > ​then myMethod will work the same way on the client or EOS. However I
> > suspect the time to dereference a pointer adds some time on the client
> side
> > that wouldn't be required by simply accessing the object directly. ​
> >
>
> This is something I would like to test. In fact, I never tried to pass
> pointer to EOS method and do not have clue if it will be working (or is
> allowed.)
>
​ This is something I can speak to. Josh pointed me (couldn't resist) to
using pointers with EOS methods as a way to pass a pointer to the server.
Great way to populate arrays instead of packing them in to blobs, for
instance.

​An even better tip​ is this:

On the server create a stored method that performs onerous lookups and
stores the results in IP vars - like objects or arrays. It can run as often
as necessary. The IP vars persist as long as the server is running.

Make an accessor method with the EOS property like so:

GetVar(text; pointer)

where $1 is just a label and $2 is ptr to the client var to populate. It
could look like this:

Case of

:($1="salesSummary")

$2->:=<>salesSummary

End case


You can call it using local vars on the client:
GetVar("salesSummary";->$obj). ​That's fast. And since you are accessing IP
vars on the server you don't need to worry about accessing a particular
server process - server side IP vars are available to any instance of the
'twin' process. And since you are only reading the vars you don't need to
worry about locking them on the server. Unless you are using them in some
dynamic way which isn't what I'm describing here. Works v13+.​

-- 
Kirk Brooks
San Francisco, CA
=======================

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

*- Edmund Burke*
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to