Skip to main content

Filtering with Loops in Javascript - How to Avoid Insanity


Show first post

31 replies

kuovonne
Forum|alt.badge.img+17
  • Brainy
  • 5993 replies
  • September 28, 2022
Bill_French wrote:

Yes, and when doing this, it leaves few other dials to increase performance which means, higher throughput must come from all that happens around the 50-item batching.

One approach to faster performance is to not need fast throughput in the first place. You must assess things like -

  • Is it possible to do this process slowly without impacting users or the usability of your solution?
  • Reflect on the pathway that got you into this challenge in the first place? Is the data model painting you into a corner where massive batch updates are necessary?
  • Have you exhausted the possibility of a fully event-driven [real-time] architecture? This is to suggest that by processing data items as they occur, you spread the updates over minutes, seconds, and micro-seconds to eliminate the need to ever batch process anything.

Excellent points. I was thinking of where hashes are most useful in the context of an Airtable script.

Given that @Nick_Richards says that his script is 8 lines long, updates only 150 records, and runs only once a quarter, I think that it is pretty safe to say that he does not need to implement the excellent techniques that you are suggesting.

If you want to continue with scripting, this is definitely a technique to keep handy. Bill imparted it to me early in my Airtable scripting journey and it has served me well. However, it has been many years since Bill was new to coding, and some of his advanced techniques are for more extreme situations than new coders typically encounter.


  • Author
  • Inspiring
  • 3264 replies
  • September 28, 2022
kuovonne wrote:

Excellent points. I was thinking of where hashes are most useful in the context of an Airtable script.

Given that @Nick_Richards says that his script is 8 lines long, updates only 150 records, and runs only once a quarter, I think that it is pretty safe to say that he does not need to implement the excellent techniques that you are suggesting.

If you want to continue with scripting, this is definitely a technique to keep handy. Bill imparted it to me early in my Airtable scripting journey and it has served me well. However, it has been many years since Bill was new to coding, and some of his advanced techniques are for more extreme situations than new coders typically encounter.


LOL! Then this should take about 9 seconds max unless I’m missing something.


kuovonne
Forum|alt.badge.img+17
  • Brainy
  • 5993 replies
  • September 28, 2022
Bill_French wrote:

LOL! Then this should take about 9 seconds max unless I’m missing something.


You’re over thinking it. He was originally updating records one at a time in an automation script.

And nine seconds is a bit long to me. I would expect more like 3-5 seconds (most of which is spent waiting for the three batches of 50 records to be updated).


  • Author
  • Inspiring
  • 3264 replies
  • September 28, 2022
kuovonne wrote:

Excellent points. I was thinking of where hashes are most useful in the context of an Airtable script.

Given that @Nick_Richards says that his script is 8 lines long, updates only 150 records, and runs only once a quarter, I think that it is pretty safe to say that he does not need to implement the excellent techniques that you are suggesting.

If you want to continue with scripting, this is definitely a technique to keep handy. Bill imparted it to me early in my Airtable scripting journey and it has served me well. However, it has been many years since Bill was new to coding, and some of his advanced techniques are for more extreme situations than new coders typically encounter.


My comment was intended in the context of an Airtable script. We often assume that to use external data we must import it into Airtable and then lookup into it with a script or other relational automation process. Better, in some cases, to avoid bringing in data and relying (instead) on late binding processes that perform very fast queries against a hash index.


  • Author
  • Inspiring
  • 3264 replies
  • September 28, 2022
kuovonne wrote:

You’re over thinking it. He was originally updating records one at a time in an automation script.

And nine seconds is a bit long to me. I would expect more like 3-5 seconds (most of which is spent waiting for the three batches of 50 records to be updated).


Okay - but the entire meme of this topic is to not underthink it. :winking_face: This is what it looks like when I don’t underthink.


  • Inspiring
  • 251 replies
  • September 30, 2022
Bill_French wrote:

Okay - but the entire meme of this topic is to not underthink it. :winking_face: This is what it looks like when I don’t underthink.


I really like this TOPIC and @Bill.French 's point of view:
to have gradually educated us to think about flying over our problems with a drone
instead of only searching the streets house by house, as a fireman would say when helping after a flood.

To stay in the metaphor, Bill FRENCH also teaches us how to build seawalls, deviate (data) streams
so that we don’t have to suffer floods again and again.
I’m very grateful for this teaching because it’s not what I found most easily elsewhere:
You learn languages, well known patterns, exceptions, workaround or hacky stuff
in several communities that talk about javascript, data, tables and frontend.
But flying over the landscape with a drone before starting to enter the streets and houses,
That’s really the line of Bill French’s teaching since I’m coming on the airtable community.

Then I agree with @kuovonne that it is not necessary to learn to fly a drone
if putting a ladder on a single house to look at it from its roof is enough.
But this Topic still needs the drone I think.
It did us good and it reminds us regularly.

Only one regret?
In all the airtable resources, community included, I don’t think I made a mistake
by not finding any example of script using hash index in the airtable context.
Am I wrong?

Why don’t I share this nice script exploiting hash index myself ?
Oh My god ! If you knew in which pit (from my own initial ignorance of GCP) I’m currently diving while breathing a " high depth " mix :grinning_face_with_big_eyes:
I will come back to you as soon as possible in another section (…CDN…) not to name it with a show&tell but I’m not ready yet since I’m only a part-time scripter and largely selftaught as soon as I get out of the airtable community incubator.

Bests,

oLπ


Reply