Skip to content

Get script error handler only when needed - #1615

Closed
jbochi wants to merge 1 commit into
redis:unstablefrom
jbochi:simplify_error_handler
Closed

jbochi wants to merge 1 commit into
redis:unstablefrom
jbochi:simplify_error_handler

Conversation

@jbochi

@jbochi jbochi commented Mar 18, 2014

Copy link
Copy Markdown
Contributor

I believe this change improves scripting.c evalGenericCommand readability.

Instead of pushing the error handler before the function lookup (that needs to clean the stack if it fails), we can get the error handler just before the pcall, using lua_insert to move the error handler function to the proper position in the stack.

Besides avoiding the lua_pop when lookup fails, I believe it's easier to understand why the error handler is now being pushed into the stack, since it is closer to pcall function call and it also explains the -2 pcall argument naturally.

mattsta pushed a commit to mattsta/redis that referenced this pull request Aug 2, 2014
Cleans up the flow of code to read much easier too.

Closes redis#1615
@mattsta mattsta mentioned this pull request Aug 2, 2014
mattsta pushed a commit to mattsta/redis that referenced this pull request Aug 6, 2014
Cleans up the flow of code to read much easier too.

Closes redis#1615
@mattsta

mattsta commented Aug 25, 2014

Copy link
Copy Markdown
Contributor

Denied because "adds a new call in the likely code path in order to remove two calls in the unlikely (error) code path. The added call, lua_insert, needs to shift elements in the stack, so it performs a (short in this case) for loop. To accept such a patch a profiling activity should be done in order to ensure no speed regression: not worth it IMHO."

@mattsta mattsta closed this Aug 25, 2014
@jbochi

jbochi commented Aug 25, 2014

Copy link
Copy Markdown
Contributor Author

ok, thanks

YaacovHazan pushed a commit that referenced this pull request Jul 16, 2026
## Changelog

### RedisJSON
[v8.9.81...v8.9.90](RedisJSON/RedisJSON@v8.9.81...v8.9.90)
- MOD-16300 perf(json_path): materialize filter literals once per query
([#1615](RedisJSON/RedisJSON#1615))
- MOD-16608 Bump ijson (reduce object memory)
([#1617](RedisJSON/RedisJSON#1617))
- MOD-16274 | MOD-16275 add size/sizeof and empty operators on object
([#1618](RedisJSON/RedisJSON#1618))
- MOD-16685 Add RedisJSON API to open from RedisModuleKey
([#1619](https://github.com/RedisJSON/RedisJSON/pull/1619)/[#1620](https://github.com/RedisJSON/RedisJSON/pull/1620))

### RedisBloom
[v8.9.81...v8.9.90](RedisBloom/RedisBloom@v8.9.81...v8.9.90)
- No functional changes — version bump only
([#1033](RedisBloom/RedisBloom#1033))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants