Skip to content

Remove ListenersNotificationBenchmark dependency on the Listeners class - #9

Merged
manoelcampos merged 1 commit into
masterfrom
issue-8-listeners-notification-without-listeners-class
Oct 20, 2026
Merged

manoelcampos merged 1 commit into
masterfrom
issue-8-listeners-notification-without-listeners-class

Conversation

@manoelcampos

Copy link
Copy Markdown
Contributor

Closes #8

Changes

  • ListenersNotificationBenchmark creates the arrays of listeners itself (newListeners()) and builds the lists with List.of(array), instead of using Listeners.add() (only available in CloudSim Plus 9).
    This gives the same List classes CloudSim Plus uses (List12 for 1 or 2 listeners, ListN for 0 or 3+).
  • The toArray() helper was removed, since the array is now created first and the list is built from it.
  • Updated the class Javadoc.
  • Removed the exclusion of this benchmark from the cloudsimplus-8 profile in pom.xml.

Tests

Built and ran the benchmark (short run: -f 1 -wi 1 -i 1 -w 1s -r 1s) with:

  • ./mvnw clean package -Pcloudsimplus-8 (CloudSim Plus 8.5.1)
  • ./mvnw clean package (CloudSim Plus 9.0.0-SNAPSHOT)

Both compile and produce similar results.

🤖 Generated with Claude Code

The benchmark now creates the arrays of listeners itself and builds the
lists with List.of(array), which gives the same List classes CloudSim Plus
uses. This way, it compiles against both CloudSim Plus 8.5.1 and 9, and the
cloudsimplus-8 profile doesn't need to exclude it anymore.

Closes #8

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@manoelcampos manoelcampos self-assigned this Oct 20, 2026
@manoelcampos
manoelcampos merged commit 57eef4f into master Oct 20, 2026
1 check failed
@manoelcampos
manoelcampos deleted the issue-8-listeners-notification-without-listeners-class branch October 20, 2026 21:31
manoelcampos added a commit that referenced this pull request Oct 20, 2026
…ys (PR #6 and #9)

Measures the time and memory to notify listeners stored in immutable lists
(as created by the Listeners class from cloudsimplus/cloudsimplus#586) and in plain arrays.
Run with -prof gc to see if the for-each loop creates an iterator.

The benchmark builds the lists itself with List.of(array), which gives the same
List classes CloudSim Plus uses, without depending on the Listeners class.
This way, it compiles against both CloudSim Plus 8.5.1 and 9.

Closes #8

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

ListenersNotificationBenchmark shouldn't depend on the Listeners class from CloudSim Plus 9

1 participant