Category Archives: Unsorted

Looking in the future @Pharodays

Really great talks at PharoDays

  • Object centric debuggers
  • New test infrastructure
  • Example driven development
  • Spec2 with GTK backend
  • UI testing
Advertisements

About Performance Issues

Hi, this will be a long mail. I have organized it in different sections.

This work is sponsored by the Pharo consortium and financially supported by Lifeware and Schmidt.
Summary:
======

– There are performance issues in Pharo 7.
– I have made benchmarks.
– With Guille we made an improvement in saving source code in methods.
– More improvements to come.
– Automation and CI in the future.

Background
=========

Since the release of Pharo 7 (and before it), it was notorious that
there exists a performance regression in the normal execution of the
image. By checking the usual operations, we have seen ( and many have
also detected) that there was an issue with the loading, compilation,
and unloading of code. Also with the creation of classes, traits and
the use of slots.

Benchmarks
=========

Although we were sure that there is a performance regression, we have
to show it in a way we can test it and measure it. If we cannot
measure it or repeat its execution it is worthless.
For doing so, I have created an initial set of micro-benchmarks to
cover normal operations of the image.

The set of benchmarks is available here:
https://github.com/tesonep/pharo-benchmarks

These benchmarks are developed on top of SMark, only adding a command
line tool and the ability to generate a CSV file.

The idea is to run the benchmarks in different versions of Pharo an
assert that we are not breaking anything.

The first results were basically a nightmare, some operations take
almost 20 times more in Pharo 7. Especially, the ones that are
compiling methods.

In the attached document, there is the detail of all the benchmarks,
the different results and the analysis of the improvements and
regressions (Positive percentages are regressions (more time),
negative are improvements (less time)).

I have checked the results in OSX with 64 bits images. But as the
problem is in pure Smalltalk implementations the problems are (and the
solutions) cross platforms.

First Improvement
==============

Having the benchmarks, it was easy to start looking for the problems.
Thanks to the help of Guille we have detected some problems in the
implementation of SourceFile. Objects of this class have the
responsibility to handle the save of the source code when a method is
modified.

Improving this implementation we have gotten to results similar to
Pharo 6 in the compilation of methods.

Comparing a stock Pharo8 image with the one with the fix, we have the
following improvements:

AddingAnInstanceVariableToAClassWithASubclass -3.96%
AddingAnInstanceVariableToAClassWithoutASubclassAndInstances -15.91%
AddingAnInstanceVariableToAClassWithoutSubclasses -28.50%
ClassAndSubclassCreation -25.67%
ClassUsingATrait -90.05%
SimpleClassCreation -26.55%
TraitCreation -92.95%
TraitCreationUsingOtherTrait -91.68%
CompileAMethodAndModifyIt -32.92%
CompileAMethodInAClassUsingATrait -83.28%
CompileAMethodInATraitNotUsed -85.12%
CompileAMethodInATraitUsed -88.16%
CompileANewMethod -40.73%
CompileANewMethodUsingInstanceVariable -33.93%
MethodAccessingAGlobal -47.57%

Again there are more details in the attached file.

Also, we have ported this fix to Pharo 7.

Next Steps
========

– Making it a part of the CI infrastructure: making it run in each PR
and build to detect regressions in the changes.

– Adding more micro and macro benchmarks. I have a list of things to
test, but I am open to more:

# Micro

– Slot Implementation
– Process handling
– Refactorings
– Files (open / write / read)

# Macro

– Loading:  Moose  / Seaside
– Recompile All
– Condense Sources
– Startup
– Shutdown

We also know that there are platform related issues (especially
Windows), so the idea it will be the same, build a benchmark, measure
it, improve it.

The idea is to have a more robust way of detecting and handling the
performance of Pharo. Of course, I am open to all your comments.

Cheers,
Pablo

[Ann] NeoDNS

About Paleo-DNS….
This did already exist in various forms, a couple of years ago I made a newer version, they can all be found in http://www.smalltalkhub.com/#!/~BenComan/DNS/ – including unit tests (but some of the older code in there is a bit stale).

It covers most record types, but most of them are not used a lot.

Simple usage:

NeoSimplifiedDNSClient default addressForName: ‘pharo.org‘. “104.28.27.35”

One of my goals was to use it as a more reliable, non-blocking ‘do we have internet access’ test:

NeoNetworkState default hasInternetConnection. “true”

From the class comments:

=======================
I am NeoSimplifiedDNSClient.

I resolve fully qualified hostnames into low level IP addresses.

NeoSimplifiedDNSClient default addressForName: ‘stfx.eu‘.

I use the UDP DNS protocol.
I handle localhost and dot-decimal notation.

I can be used to resolve Multicast DNS addresses too.

NeoSimplifiedDNSClient new useMulticastDNS; addressForName: ‘zappy.local’.

Implementation

I execute requests sequentially and do not cache results.
This means that only one request can be active at any single moment.
It is technically not really necessary to use my default instance as I do not hold state.
====================================
I am NeoDNSClient.
I am a NeoSimplifiedDNSClient.

NeoDNSClient default addressForName: ‘stfx.eu‘.

I add caching respecting ttl to DNS requests.
I allow for multiple outstanding requests to be handled concurrently.

Implementation

UDP requests are asynchroneous and unreliable by definition. Since DNS requests can take some time, it should be possible to have multiple in flight at the same time, thus concurrently. Replies will arrive out of order and need to be matched to their outstanding request by id.

If a request has been seen before and its response is not expired, it will be answered from the cache.

Each incoming request is handled by creating a NeoDNSRequest object and adding that to the request queue. This triggers the start up of the backend process, if necessary. The client then waits on the semaphore inside the request object, limited by the timeout.

The backend process loops while there are still outstanding requests that have not expired. It sends all unsent requests at once, and then listens briefly for incoming replies. It cleans up expired requests. When a reply comes in, it is connected to its request by id. The semaphore in the request object is then signalled so that the waiting client can continue and the request is removed from the queue. The process then loops. If the queue is empty, the backend process stops.

Sven

[Ann] Paleo-DNS

Norbert and me looked at using DNS for service discovery and ran into some of the limitations of the NetNameResolver[1]. In the end I created an initial DNS implementation in Pharo called Paleo-DNS[2] to overcome these.

DNS is a protocol we use every day but rarely think of. There is an active IETF community that is evolving the protocol and finding new usages (service discovery is one of them).

In DNS there are different types of resource records (RR). The most commonly used ones in a client (“stub”) are “A” for IPv4 addresses, “AAAA” for IPv6 addresses, “CNAME” for aliases, “SRV” records. So far only support for “A” records was implemented.

So if you are curious about DNS then this is a great opportunity to add your favorite RR implementation to it and send a PR. There are probably 20+ of them to go. 😉

Query example using DNS-over-TLS (DoT) to Google Public DNS

PaleoDNSTLSTransport new
destAddress: #[8 8 4 4] port: 853;
timeout: 2 seconds;
query: (PaleoDNSQuery new
transactionId: (SharedRandom globalGenerator nextInt: 65535);
addQuestion: (PaleoRRA new rr_name: ‘pharo.org.’);
addAdditional: (PaleoRROpt new udpPayloadSize: 4096))

[1] It’s blocking on Unix, on Mac only one look-up may occur at a time and it returns exactly one address. There is also no IPv6 support.

[2] https://github.com/zecke/paleo-dns

[Ann] Pharo Launcher 1.8.1

Hi all,

Pharo Launcher 1.8.1 has just been released! It is available from http://pharo.org/download.
Here is the changelog:

Bug fixes:

  • #326 Edit image description doesn’t update when editing existing description
  • #325 Instance of MacProcess did not understand #waitForCommand:
  • #324 sources file not found for Pharo < 3.0
  • #321 abort process if not responding. Uses TaskIt
Improvements:
  • #239 Mac OS menus display “SqueakOSXApp” instead of « PharoLauncher »
  • #323 Check if pharo-version.st should be updated
  • #322 do not try to run image without preferences if not supported by the image
Thanks to all contributors, including issue reports.
Regards,
The Pharo team.

[Ann] Managing your Code with Iceberg

Hi

A first version of the first part of the book “managing your book with iceberg” is available at http://books.pharo.org.

 

S.&G.

[Ann] Pharo with Style at books.pharo.org

Hi

I happy to announce that Pharo with Style is now available from http://books.pharo.org.

If you want to sponsor this book, let me know 🙂

Stef

[Ann] How to get started with Iceberg

Hello

 

I’m happy to announce a new booklet (soon to be released) on how to manage code with Iceberg. We plan to discuss management patterns in the future.

https://github.com/SquareBracketAssociates/Booklet-ManagingCode

Stef and Guille