Skip to content

Feature/macros#28

Merged
shaharyarn merged 17 commits intomasterfrom
feature/macros
Aug 17, 2020
Merged

Feature/macros#28
shaharyarn merged 17 commits intomasterfrom
feature/macros

Conversation

@shaharyarn
Copy link
Copy Markdown
Collaborator

@shaharyarn shaharyarn commented May 26, 2020

Linked core PR: tomlegkov/marine-core#35

Copy link
Copy Markdown
Collaborator

@yehonatanz yehonatanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The core concept seems good, I do however have some notes regarding the implementation.

@shaharyarn shaharyarn requested a review from yehonatanz May 27, 2020 06:16
Copy link
Copy Markdown
Owner

@tomlegkov tomlegkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice implementation, I like it 👍

I'm mainly concerned about hits to performance


class Marine:
SUGGESTED_MACROS = {
"macro.ip.src": ["ip.src", "arp.src.proto_ipv4"],
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ipv6?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a part of the macro because it isn't in the current version of marine.

self._marine.destroy_marine()

@classmethod
def _expand_macros(
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you analyze the performance of the macros? I recall it slowing down Marine quite significantly.

Since the macros field is usually the same (or from a basically closed set), a caching mechanism can speed this up nicely :)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does slow the performance of marine.
More percisely, it slows from around 15,000 pps to 12,500 pps.

I tried implementing a caching mechanism but that did not help the performance. I think this is due to the fact that we can only cache the action performed by _expand_macros, while _collapse_macros is performed per result.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem too bad for me (but sucks of course).
Remove the caching mechanism if it doesn't help.

Base automatically changed from feature/choosing-encapsulation to master May 31, 2020 06:05
@shaharyarn shaharyarn requested a review from tomlegkov May 31, 2020 11:30
self._marine.destroy_marine()

@classmethod
def _expand_macros(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem too bad for me (but sucks of course).
Remove the caching mechanism if it doesn't help.

@yehonatanz yehonatanz linked an issue Jun 24, 2020 that may be closed by this pull request
Copy link
Copy Markdown
Collaborator

@yehonatanz yehonatanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had some notes, but my main worry is that the macros_indices API is too complicated, and therefore makes your client code too complicated.
See my note on the C code here: tomlegkov/marine-core#35 (review)

@shaharyarn shaharyarn requested a review from yehonatanz July 19, 2020 12:36
Copy link
Copy Markdown
Collaborator

@yehonatanz yehonatanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a tiny note, but this looks good!

@shaharyarn shaharyarn requested a review from tomlegkov August 13, 2020 12:11
@shaharyarn shaharyarn merged commit 8195897 into master Aug 17, 2020
@shaharyarn shaharyarn deleted the feature/macros branch August 17, 2020 17:44
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.

Support field_templates (macros)

3 participants