• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Blogs
  2. Verification
  3. Performance Tips and Tricks: Another Specman Performance…
teamspecman
teamspecman

Community Member

Blog Activity
Options
  • Subscribe by email
  • More
  • Cancel
performance
Specman
Functional Verification
Testbench simulation
EDA
e
team specman
Aspect Oriented Programming
AOP

Performance Tips and Tricks: Another Specman Performance Series

23 Aug 2010 • 1 minute read

Building on the great success of Efrat Shneydor's previous blog series, Performance-Aware e Coding Guidelines, a new "Specman Performance Handbook" was added to the 9.2 release of Specman Elite that included, on top of the previous blog items, a slew of other important tips and techniques on how to create more performance friendly code.  Below is the first in a 5 part series of blogs based on excerpts from this Handbook.

Tip 1: Do Not Use delete(0) to Remove items from the Beginning of a List

One way to remove the first few items of a list that obey a particular rule is to use a while loop that checks the first item in the list in respect to that rule and then delete it using list.delete(0). However, using delete(0) negatively affects performance.

Impact:

  - Wall clock

Explanation:

Because delete() maintains the order of the list, each delete(0) is implemented by moving the rest of the list one cell up. Doing this several times is highly inefficient.

You can, instead:

  1. Use a local variable to count until the required index is found.
  2. Copy the list to itself starting from that counter.

Example:

Use:

extend packet {

improved_remove_sfd() is {

var shift: int = data.first_index(it != 0x55);

// count the shift of the sfd

if (shift != UNDEF) {

data = data[shift..];

// GOOD - allocation and copying are done only once

};

};

};

Instead of:

            extend packet {

bad_remove_sfd() is {

while data[0] == 0x55 {

data.delete(0); // BAD - does many unnecessary copies

};

};

};

Now, this is not to say that every use of delete(0) is necessarily a bad thing.  delete(0) is a very compact way to delete a single item from the front of a list and may make sense to use in many situations.  Just be aware of the performance penalty when using it repeatedly or in many locations within the code.

Next week, we will be pulling another tidbit out of the new 9.2 Specman Performance Handbook available within the Cadence Help System.  We will be discussing Ports.

Hope this helps! 

Team Specman

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information