Jira (PUP-8610) PuppetStack.stacktrace is slow with a large stack

1 view
Skip to first unread message

Nick Lewis (JIRA)

unread,
Mar 27, 2018, 3:10:04 PM3/27/18
to puppe...@googlegroups.com
Nick Lewis created an issue
 
Puppet / Bug PUP-8610
PuppetStack.stacktrace is slow with a large stack
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2018/03/27 12:09 PM
Priority: Normal Normal
Reporter: Nick Lewis

Several places in Puppet call PuppetStack.stacktrace[0] to get their "caller". Most notably, log messages where the "source" is a Scope object without an associated resource use that method to determine the "source" to log from. There are also some Puppet functions that use it (empty, create_resource, and more).

Those calls become quite slow (I saw up to 50ms) when the stack is large. While it's probably uncommon for the stack to grow that deep, no caller currently uses anything but the top element of the stack, which means this is a straightforward opportunity for improvement.

It probably makes sense to either make that method lazy, which is a bit of a challenge as it's both a filter and a map, or to add a method that specifically returns the top element of the stack, which satisfies every current caller.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Henrik Lindberg (JIRA)

unread,
Mar 28, 2018, 8:38:03 AM3/28/18
to puppe...@googlegroups.com
Henrik Lindberg commented on Bug PUP-8610
 
Re: PuppetStack.stacktrace is slow with a large stack

The difficult bit is that the top of the "puppet stack" is at an unknown distance from the top of the "ruby stack" it is mixed into. A search would need to loop with a given batch size - remains to be seen if that is faster.

 

We can certainly add a "get top of puppet stack" method to make it possible to optimize.

 

Nick Lewis did you get a feel of if the increased time is because getting large stack from Kernel is slow, or because it gets large number of entries to match against and build new array?

 

Henrik Lindberg (JIRA)

unread,
Mar 28, 2018, 2:02:03 PM3/28/18
to puppe...@googlegroups.com
Henrik Lindberg updated an issue
 
Change By: Henrik Lindberg
Fix Version/s: PUP 6.0.0
Fix Version/s: PUP 5.5.z

Henrik Lindberg (JIRA)

unread,
Mar 28, 2018, 2:03:03 PM3/28/18
to puppe...@googlegroups.com
Henrik Lindberg updated an issue
Change By: Henrik Lindberg
Sub-team: Language
Release Notes Summary: optimization
Team: Platform Core
Sprint: Platform Core KANBAN
Release Notes: Not Needed

Henrik Lindberg (JIRA)

unread,
Mar 28, 2018, 2:03:03 PM3/28/18
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Apr 3, 2018, 5:01:37 PM4/3/18
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Fix Version/s: PUP 5.5.z
Fix Version/s: PUP 5.5.1

Henrik Lindberg (JIRA)

unread,
Apr 4, 2018, 2:07:03 PM4/4/18
to puppe...@googlegroups.com
Henrik Lindberg assigned an issue to Unassigned
Change By: Henrik Lindberg
Assignee: Nick Lewis

Jacob Helwig (JIRA)

unread,
Apr 13, 2018, 4:18:02 PM4/13/18
to puppe...@googlegroups.com

John Duarte (JIRA)

unread,
Oct 21, 2019, 10:53:03 AM10/21/19
to puppe...@googlegroups.com
John Duarte updated an issue
 
Change By: John Duarte
QA Risk Assessment: Needs Assessment No Action
Reply all
Reply to author
Forward
0 new messages