You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The reason will be displayed to describe this comment to others. Learn more.
Its good to have a check if it's needed, but this unfortunately it still hurts performance in some scenarios.
For example, we're importing a lot of data to the Accounts, which means the search index gets rebuilt. Not being obvious, this was excluded from my rake task...
... and then viewing an index page suddenly takes minutes and does a lot of writes for a GET request, due to this and the before_filter .
IMO, ransack UI is doin' it wrong - it would be better to shift this to happening at the CRUD controller level for entities, or perhaps an after_save hook on the model.
The reason will be displayed to describe this comment to others. Learn more.
Will pin down the exact culprit, but if I said 'lots of get requests', I
meant to say lots of selects, followed by updates (approx 3:1 ratio).
IMO any write to the db on a GET for a resource or list of resources isnt
good.
Will do sample test script, data and put in a bug report...
On 19/06/2013 3:31 PM, "Steve Kenworthy" ***@***.*** wrote:
[image: attribute_collection_for_bases]https://f.cloud.github.com/assets/149198/673035/8961a710-d8a5-11e2-957a-1fb03b79eea7.png
Looks like translation is being overused...? A lot of calls and taking the
time. Perhaps there is a more efficient way to code this?
—
Reply to this email directly or view it on GitHubhttps://github.com/fatfreecrm/fat_free_crm/commit/55f881e0738b0ed61c8c4087e3de6fc47dcd1e89#commitcomment-3455224
.
55f881e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its good to have a check if it's needed, but this unfortunately it still hurts performance in some scenarios.
For example, we're importing a lot of data to the Accounts, which means the search index gets rebuilt. Not being obvious, this was excluded from my rake task...
... and then viewing an index page suddenly takes minutes and does a lot of writes for a GET request, due to this and the before_filter .
IMO, ransack UI is doin' it wrong - it would be better to shift this to happening at the CRUD controller level for entities, or perhaps an after_save hook on the model.
55f881e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding @ndbroadbent to discussion
I've done a bit of benchmarking and the culprit of the slow search load is the 'attribute_select' function in ransack (not ransack_ui). See https://github.com/ernie/ransack/blob/v0.7.2/lib/ransack/helpers/form_builder.rb#L21 There's already a ransack issue open for this but doesn't seem to have been resolved yet. See activerecord-hackery/ransack#154
I'm interested in what you mean by the index page doing a lot of GET requests... this doesn't sound like typical behaviour?
55f881e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: the 'attribute_collection_for_base' seems to be eating the time, This is called in attribute_select. Here's a benchmark:
55f881e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like translation is being overused...? A lot of calls and taking the time. Perhaps there is a more efficient way to code this?
55f881e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.