Newsletter August 2020

JuliaCon 2020: Nearly 30,000 Julia users worldwide tuned in to JuliaCon 2020 on YouTube – more than 3x the number who viewed last year – and JuliaCon 2020 registrants represent 115 different countries. We extend our gratitude and appreciation to all those who made JuliaCon 2020 the biggest and best JuliaCon ever – participants, presenters, organizers, committee members, sponsors, volunteers, mentors and the entire Julia community. If you missed any JuliaCon 2020 presentations, they are now available online.

JuliaCon 2020 Wrap-Up Blog Posts

JuliaTeam and JuliaRun Presentation: If you missed Dr. Matt Bauman’s demonstration of JuliaHub’s upcoming compute capabilities during JuliaCon, you can find it online, along with nearly 20 other free Julia Computing Webinars and microtrainings.

Pumas-AI: Pumas-AI is a new pharmaceutical startup company that launched this week. The launch event has been watched by hundreds of viewers around the globe.  Pumas-AI uses artificial intelligence in Julia to accelerate drug development and personalize patient care. For more information, visit Pumas-AI.

JuliaHub Launch: Julia Computing is pleased to announce the launch of JuliaHub’s compute capabilities. JuliaHub provides a seamless experience for Julia users to manage their packages, find documentation, make open source contributions and run large compute-intensive workloads. Click here to sign up to receive notification when cloud computing is available via JuliaHub, and click here to register for a demonstration of JuliaHub’s new cloud computing capabilities.

Julia Computing Finance Webinar and JuliaHub Product Demo: Julia Computing’s Dr. Matt Bauman will present a free Webinar on Accelerating Finance with Julia and a JuliaHub product demonstration. Use the links below to register.

Title

Date

Presenter

Time

Registration link

Going on a   Bull Run:   Accelerating   Finance with   Julia

Thursday   Aug 27

Dr. Matt   Bauman, Julia   Computing   Director of   Applications   Engineering

 12-1 pm   Eastern   (US)

Click here   to register

JuliaHub Product Demo: Introducing Single Click Scaling and Deployment in the Cloud

Thursday Sep 3

Dr. Matt Bauman, Julia Computing Director of Applications Engineering

12-1 pm Eastern (US)

Click here   to register

Julia Computing Enterprise Products

  • JuliaHub: JuliaHub from Julia Computing provides a seamless experience for Julia users to manage their packages, find documentation, make open source contributions and run large compute-intensive workloads. Click here for more information.
  • JuliaRun: JuliaRun from Julia Computing helps you scale and deploy Julia using high performance computing (HPC) resources, including large parallel simulations and analyses in the cloud: AWS, Microsoft Azure or Google Cloud. Click here for more information.
  • JuliaSure: JuliaSure from Julia Computing provides full service development support, production support and indemnification for companies using Julia. Subscriptions are USD $99 per month. Click here to subscribe.
  • JuliaTeam: JuliaTeam from Julia Computing lets your entire enterprise work together using Julia. Collaborate, develop and manage private and public packages across your organization, manage open source licenses and benefit from continuous integration, deployment, security, indemnity and enterprise governance. Click here for more information.
  • Pumas: Pumas from Julia Computing and Pumas.ai is a comprehensive platform for pharmaceutical modeling and simulation, providing a single tool for the entire drug development pipeline. Click here for more information.

Julia Computing Is Coming to Your Favorite Online Conferences: Julia Computing is participating in several upcoming online conferences. Please join our Julia talks and workshops or connect with us.

Julia 1.5 Release: Julia 1.5 includes exciting new features such as struct layout and allocation optimizations, multithreading API stabilization and improvements and much more. More information is available here.

Julia Community Prizes: The winners of the 2020 Julia Community Prizes are Huda Nassar, Mosè Giordano and Chris Elron. Congratulations!

Julia User & Developer Survey 2020: The second annual Julia User & Developer Survey was presented during JuliaCon. Results are available here.

Julia and Julia Computing in the News

  • ZDNet: Programming Language Julia Version 1.5 Is Out: Lots of New Features, Better Performance
  • Analytics India: JuliaCon 2020 Is Live and Virtual
  • Analytics India: Julia and PyCaret Latest Versions
  • Daily Excelsior: Data Science – the New Paradigm of Technology
  • Enterprise Talk: Julia Version 1.5 Launched
  • Analytics India: Julia v1.5 Released: Brings Lots of New Features and Better Performance
  • Dev Class: Julia 1.5 Tackles Latency and Heap Allocations Before Tossing in Another LTS Release
  • Dev Class: Bye-Bye Juno, Hello Julia for VS Code – IDE Shifts Form, Reaches 1.0
  • PC World: Learn a New Programming Language with this $15 Humble Bundle
  • SD Times: Julia 1.5 Released
  • Heise: Programmiersprache: Julia 1.5 Stabilisiert die Multithreading-API
  • Analytics Insight: What Will Be the Best Language for Data Science – Julia or Python?
  • I Programmer: Julia 1.5 Improves Struct Layout Support

Julia Blog Posts

Upcoming Julia Online Events

Recent Julia Online Events

Julia Jobs, Fellowships and Internships

Do you work at or know of an organization looking to hire Julia programmers as staff, research fellows or interns? Would your employer be interested in hiring interns to work on open source packages that are useful to their business? Help us connect members of our community to great opportunities by sending us an email, and we’ll get the word out.

There are hundreds of Julia jobs currently listed on Indeed.com. Click here to apply.

Contact Us: Please contact us if you wish to:

  • Purchase or obtain license information for Julia Computing products such as JuliaSure, JuliaTeam, JuliaRun or Pumas
  • Obtain pricing for Julia consulting projects for your organization
  • Schedule online Julia training for your organization
  • Share information about exciting new Julia case studies or use cases
  • Spread the word about an upcoming online event involving Julia
  • Partner with Julia Computing to organize a Julia event online
  • Submit a Julia internship, fellowship or job posting

About Julia and Julia Computing

Julia is the fastest high performance open source computing language for data, analytics, algorithmic trading, machine learning, artificial intelligence, and other scientific and numeric computing applications. Julia solves the two language problem by combining the ease of use of Python and R with the speed of C++. Julia provides parallel computing capabilities out of the box and unlimited scalability with minimal effort. Julia has been downloaded by users at more than 10,000 companies and is used at more than 1,500 universities. Julia co-creators are the winners of the 2019 James H. Wilkinson Prize for Numerical Software and the 2019 Sidney Fernbach Award. Julia has run at petascale on 650,000 cores with 1.3 million threads to analyze over 56 terabytes of data using Cori, one of the ten largest and most powerful supercomputers in the world.

Julia Computing was founded in 2015 by all the creators of Julia to develop products and provide professional services to businesses and researchers using Julia.

The String, or There and Back Again

By: Blog by Bogumił Kamiński

Re-posted from: https://bkamins.github.io/julialang/2020/08/13/strings.html

Introduction

The String type in the Julia language supports the full range of Unicode
characters, which is great in practice. Other features that are important
when working with the String type (especially when you need performance)
are the following:

  • String is immutable, but it is not interned (notably Symbols are
    interned and thus can be compared using === fast);
  • taking a single character from a String produces a Char, which is a 32-bit
    value;
  • Julia Base normally assumes that String is UTF-8 encoded which is handy
    because most likely your source is UTF-8 encoded and in general UTF-8 has
    a reasonably compact memory footprint (but Strings that contain invalid
    encodings are allowed to be constructed, and it is possible to
    transcode strings).

While I think that the Julia manual Section on Strings does a very
good job explaining how they work I often find that people are confused by the
consequences of UTF-8 encoding of String and this post is intended to cover
this ground a bit more in depth.

All what I write here was tested under Julia 1.5.

Two types of indices for String

Since String is UTF-8 encoded one character is represented by 1, 2, 3, or 4
bytes in it, see e.g. Wikipedia for the details of the encoding.
In Julia you can check that indeed one code unit of String is one byte by
writing (I am storing the String in the str variable as we will soon use it
again):

julia> str = "? Hello! ?"
"? Hello! ?"

julia> codeunit(str)
UInt8

Now this string contains 10 characters, which you can check using the
length function:

julia> length(str)
10

but it is actually stored on more bytes, which the ncodeunits function tells us:

julia> ncodeunits(str)
16

The reason is that the first and last character in this string are not ASCII
(note that in UTF-8 all ASCII characters are stored on one byte), which we can
check in the following way:

julia> foreach(c -> println(repr(c), ":\t", ncodeunits(c)), str)
'?':    4
' ':    1
'H':    1
'e':    1
'l':    1
'l':    1
'o':    1
'!':    1
' ':    1
'?':    4

Given these observations the natural questions are:

  • how to get the i-th code unit in the String (so called byte index);
  • how to get the i-th character in the String (so called character index);
  • is is easy to go ‘There and Back Again’ between byte and character indices;
  • which functions expect byte indices, which expect character indices and what
    is the cost of using these functions.

Below I try to answer these questions.

Getting code units

Getting the i-th code unit is simple (but in practice rarely needed, except
if you are working with strings on low level), you just use the codeunit
function, e.g.:

julia> codeunit(str, 1)
0xf0

julia> codeunit(str, 2)
0x9f

julia> codeunit(str, 3)
0x98

julia> codeunit(str, 4)
0x84

julia> codeunit(str, 5)
0x20

or you can use the codeunits function to get them as a vector:

julia> codeunits(str)
16-element Base.CodeUnits{UInt8,String}:
 0xf0
 0x9f
 0x98
 0x84
 0x20
 0x48
 0x65
 0x6c
 0x6c
 0x6f
 0x21
 0x20
 0xf0
 0x9f
 0x91
 0x8b

Getting characters

Now, this is more tricky:

julia> str[1]
'?': Unicode U+1F604 (category So: Symbol, other)

julia> str[5]
' ': ASCII/Unicode U+0020 (category Zs: Separator, space)

julia> str[2]
ERROR: StringIndexError("? Hello! ?", 2)

and you see that the getindex function in the str[i] syntax does not give
you the i-th character in the string but rather a character that starts in the
i-th byte index in the string (and errors if at this given byte index the
character does not start).

So how should one get the i-th character in the string? Use the nextind
function in the following way:

julia> str[nextind(str, 0, 1)]
'?': Unicode U+1F604 (category So: Symbol, other)

julia> str[nextind(str, 0, 2)]
' ': ASCII/Unicode U+0020 (category Zs: Separator, space)

where you pass 0 as the first argument and the desired character index as a
second argument.

You might ask why this is so awkward? The reason is that computing the location
of i-th character in the string is expensive, so normally one should use byte
indexing. Notably, most functions working on strings take byte indices and only
one function — length — returns number of characters, all other functions
return byte indices or number of bytes (more on this below in the glossary
section).

For example (we store loc as we will use it later also):

julia> loc = findfirst(==('H'), str)
6

julia> str[loc]
'H': ASCII/Unicode U+0048 (category Lu: Letter, uppercase)

and this is fast.

Be warned though that when you use byte indexing you should not do arithmetics
on them (unless your string is ASCII only, which you can check using the
isascii function). For instance if you want to go back two characters from H
do not write:

julia> str[loc - 2]
ERROR: StringIndexError("? Hello! ?", 4)

but rather write:

julia> str[prevind(str, loc, 2)]
'?': Unicode U+1F604 (category So: Symbol, other)

and let prevind do the calculation of an appropriate byte index. Trying to do
arithmetics on byte indices is the most common error when working with Strings
in Julia.

Finally it is easy to get all byte indices that point to the start of the
character in the string with the eachindex function:

julia> foreach(i -> println("$i:\t$(repr(str[i]))"),  eachindex(str))
1:  '?'
5:  ' '
6:  'H'
7:  'e'
8:  'l'
9:  'l'
10: 'o'
11: '!'
12: ' '
13: '?'

Going there and back again between byte and character indices

If you have a byte index and want to find character index of a character that
covers this code unit then write:

julia> length(str, 1, loc)
3

Note that byte index does not have to be a valid start of a character. In this
case the index of the character that contains this index is returned:

julia> length(str, 1, 1)
1

julia> length(str, 1, 2)
1

julia> length(str, 1, 3)
1

julia> length(str, 1, 4)
1

julia> length(str, 1, 5)
2

(byte index 5 corresponds to the second character in the string)

If you have a character index and want to learn the byte index of this character
in the String we already know we should use the nextind function. For example:

julia> nextind(str, 0, 3)
6

gets you the byte index of 'H' character in the string.

The glossary

Below I present the list of functions available in Julia Base that work with
strings with a comment if they work with byte or character indices and
information about their time complexity for String type. I omit the
description what the functions do to keep the table brief and I list only the
functions that either take or return an index or byte/character number.

Funtion arguments return value complexity
length byte index characters O(n)
ncodeunits   bytes O(1)
sizeof   bytes O(1)
codeunit byte index   O(1)
isvalid byte index   O(1)
getindex byte index   O(1)
SubString byte index   O(1)
view, @view byte index   O(1)
unsafe_string byte index   O(1)
match byte index   O(n)
findfirst   byte index O(n)
findlast   byte index O(n)
findnext   byte index O(n)
findprev   byte index O(n)
firstindex   byte index O(1)
lastindex   byte index O(1)
thisind byte index byte index O(1)
prevind i: byte index, n: characters byte index O(n)
nextind i: byte index, n: characters byte index O(n)
chop character index   O(n)
first character index   O(n)
last character index   O(n)
lpad characters   O(n)
rpad characters   O(n)
textwidth   screen characters O(n)

(note that nextind and prevind are O(n) for n, but for i they are
O(1) as UTF-8 is self-synchronizing)

Conclusions

I must admit that working with the String type can be sometimes tricky, but I
hope that the summary I have presented in this post will help you easier
navigate through the options.

Finally String is not the only string type available in the Julia language.
Actually most functions just work with any AbstractString and there are
alternative string types developed in the community, you can check them out
for example here.