Maquina, the engine for Rails

Building apps over time, I found some work that needs to be done on every application: Authentication, Authorization, Mailers, etc. I started extracting this standard functionality into a Rails engine a few years ago.
Later, tailwindscss, hotwire, stimulus, and phlex entered the picture, so I started the engine again with reusable UI patterns that take advantage of these tools. This is how Maquina was born.
https://mariochavez.io/desarrollo/2023/08/08/maquina-the-engine-for-rails/

Smoothing out the scrolling experience in Chrome on Android

Smoothing out the scrolling experience in Chrome on Android

Big performance wins can be found by taking a step back and tweaking what you already have. Today’s The Fast and the Curious post explores how we improved the scrolling experience of Chrome on Android, ultimately reducing slow scrolling jank by 2x. Read on to see how we discovered and evaluated the problem, and how that has helped us design a better browser experience going forward.

When measuring the performance of a browser, one might typically think of page load speed or WebVitals. On mobile where touch interactions are common we also prioritize your interaction with Chrome to ensure it is always smooth and responsive including on new form factors like foldables. A significant focus of late has been on reducing jank while you scroll.

We recently improved the scrolling experience of Chrome on Android by 2x by filtering noise and reducing visual jumps in the content presented on screen. To get this result, we had to take a step back and figure out the problem of why Chrome on Android was lagging behind Chrome on iOS. 

As we compared Chrome across platforms, we were hit with a particular observation. iOS Chrome scrolling was smooth and consistent whereas on Android, Chrome’s scrolling didn’t follow your finger as closely. However, our metrics were telling us that while janks occurred occasionally, they weren’t as common as our perception when comparing with Chrome on iOS. Thus we had ourselves a mystery which needed some investigation.

Investigating input to output rate

Our metrics flagged that we often received input at an inconsistent rate; but since the input rate was greater than the display’s frame rate, we usually had at least one input event to trigger the production of a frame to display. However, this frame might have consumed fewer or more input events, which could result in inconsistent shifting of content on screen even while scrolling at a fixed speed.

This problem of different input rate vs frame rate is a problem that Chrome has had to address before. Internally, we resample input to predict/extrapolate where the finger was at a consistent point relative to the frame we want to produce. This should result in each frame representing a consistent amount of time and should mean smooth scrolling regardless of noise in the input events. The ideal scenario is illustrated in the following diagram where blue dots are real input events, green are resampled input events, and the displayed scroll deltas would fluctuate if you were to use the real input events rather than resampling.



Okay so we already do resampling so what’s the problem?

A tale of woe and reimplementation

Input resampling inside of Chrome (and Android) were added back in 2019 as 90hz devices emerged and the problem above became more apparent (oscillating between 2 vs 1 input events per frame rather than consistently 2 input events per frame we usually see on 60hz devices). Android implemented multiple resampling algorithms (kalman, linear, etc.) and arrived at the conclusion that linear resampling (drawing a line between two points to figure out velocity and then extrapolate to the given timestamp) was good enough for their use cases. This fixed the problem for most Android apps, but didn’t address Chrome.

Due to historical reasons and web spec requirements for raw input, Chrome uses unbuffered input and thus as devices started to appear with sampling rates that didn’t fit with input, Chrome had to implement some version of resampling. Below we see that each frame (measuring the time from input to it being displayed) consumes a different amount of input events (2 for the first, 3 for the second, and 1 for the third), if we assume input is consistently arriving and each is exactly 30 pixels of displacement then ideally we should smooth it out to 60 pixels per frame as seen below:



However, while we were investigating the original mystery we discovered that reality was very different from the ideal situation pictured above. We found that the actual input movement of the screen was quite spiky and inconsistent (more than we expected) and that our predictor was improving things but not as much as desired. On the left is real finger displacement on a screen (each point is an input event) and on the right the result of our predictor of actual content offset after smoothing out (each point is a frame)



Frames are being presented consistently on the right, but the rate of displacement spikes between one to another isn’t consistent (-50 to -40 followed by another -52 being especially drastic). Human fingers don’t move this discretely (at frame level precision). Rather they should slide and flex in a gradient, speeding up or slowing down gradually. So we knew we had a problem here. We dug deeper into Chrome’s implementation and found there were some fundamental differences in Chrome’s implementation (which was supposedly a copy of Android’s).

1. Android uses the native C++ MotionEvent timestamp (with nanosecond precision), but Chrome uses Java MotionEvent.getEventTime & MotionEvent.getHistoricalEventTime (milliseconds precision). Unfortunately, nanosecond precision was not part of the public API. However, rounding of milliseconds can introduce error into our predictor when it  computes velocity between event timestamps.

2. Android’s implementation takes care when selecting the two input events so resampling is using the most relevant events. Chrome however uses a simple FIFO queue of input events, which can result in weird cases of using future events to predict velocity in the past in rare cases on high refresh rate devices.

We prototyped using Android’s resampling in Chrome, but found it was still not perfect for Chrome’s architecture resulting in some jank. To improve on it, we experimented with different algorithms, using automation to replay the same input over and over again and evaluating the screen displacement curves. After tuning, this landed at the 1€ filter implementation that visibly and drastically improved the scrolling experience. With this filter, the screen tracks closely to your finger and websites smoothly scroll, preventing jank caused by inconsistent input events. The improvement is visible in our manual validation, on both top-end and low-end devices (Here’s a redmi 9A video example).

Going forward!

In Android 14, the nanosecond API for java MotionEvents will be publicly exposed in the SDK so Chrome (and other apps with unbuffered input) will be able to call it. We also developed new metrics that track the quality of the scroll predictors frame, by creating a test app which introduced pixel level differences between frames (and no other form of jank) and running experiments to see what people would notice. These analysis can be read about here and will be used going forward for more exciting performance wins and to make this a visible area for tracking against regressions. In the end, after tuning and enabling the 1€ filter, our metrics show a 2x reduction in visible jank while scrolling slowly! This improvement is going live in M116 as the default, but will be launched all the way back to M110 and brings Chrome on Android on par with Chrome on iOS!

The moral of the story is: Sometimes metrics don’t cover all the cases and taking a step back and investigating from the top down and getting the lay of the land can end with a superior scrolling experience for users.

Post by: Stephen Nusko, Chrome Software Engineer


Cyber-attack on UK’s electoral registers revealed

The UK’s elections watchdog has revealed it has been the victim of a “complex cyber-attack” potentially affecting millions of voters. The Electoral Commission said unspecified “hostile actors” had managed to gain access to copies of the electoral registers, from August 2021. Hackers also broke into its emails and “control systems” but the attack was not discovered until October last year. The watchdog has warned people to watch out for unauthorised use of their data. That seems like a state-level attack, and such data could easily be used for online influence campaigns during elections, something that is happening all over the western world right now. I wonder just how bad the hack actually was? “Millions of voters” sounds bad, but… The commission says it is difficult to predict exactly how many people could be affected, but it estimates the register for each year contains the details of around 40 million people. Holy cow.

Urs Pir Muhammad Karam Shah Alazhari – 7th August 2023 – Part 4 – ARY Qtv

Urs Pir Muhammad Karam Shah Alazhari

Subscribe Here: https://bit.ly/3dh3Yj1

#UrsMubarak #PirMuhammadKaramShahAlazhari #SpreadOfKnowledge #ARYQtv

Official Facebook: https://www.facebook.com/ARYQTV/
Official Website: https://aryqtv.tv/
Watch ARY Qtv Live: http://live.aryqtv.tv/
Programs Schedule: https://aryqtv.tv/schedule/
Islamic Information: https://bit.ly/2MfIF4P
Android App: https://bit.ly/33wgto4
Ios App: https://apple.co/2v3zoXW

Watch our latest Showcase Shorts, full of Moodle updates for all!

by Marie Achour.  

Hello Moodlers,

Welcome to this edition of ‘Showcase Shorts’.

Our product teams have just completed another productive sprint and we are excited to share our progress with you all!

This Showcase Short edition contains a number of interesting updates for our beloved Moodle Community Developers:

  1. An update on our progress with integrations, which are moving along at pace as we head towards code freeze for the release of Moodle LMS 4.3.

  2. Some new developments in our QA testing approach, with time-saving improvements that will benefit all our developers.

  3. Good news regarding the conversion of IconSystem from AMD to ESM, with bonus code clean-up for less tech debt – which is always a great thing!

  4. Ongoing updates to our icon component library and a demo of our new UX landing page, with handy links to useful collateral for both design & development, helping us all create a beautiful Moodle together.

  5. And more work and ideas to improve the usability of the Plugin database, one of Moodle’s best assets that deserves a bit of extra love.

 

We also progressed with the delivery of features and improvements which will be of benefit to our champion Moodle System Administrators in both educational and workplace contexts:

  1. The introduction of filters that can be applied to user tours, enabling more flexibility for administrators in creating tours for their organisations.

  2. The ability for administrators to manually assign a person’s manager in Workplace, making mapping and integration with HR systems easier.

  3. Enhanced dynamic rule functionality, allowing learning plans to be unassigned from a user automatically, reducing manual tasks needed to manage this process.

  4. And last but certainly not least, the successful upgrade of our ‘Download Moodle’ site, which will provide everyone who uses it greater stability and resilience.

The heart of our solutions, our Moodle Educators will also benefit from our recent efforts in:

  1. Simplifying the management of grade outcomes, making educators’ life easier by reducing the amount of time it takes to manage their course gradebooks.

  2. Enhancing pre-configured LTI tool management at a course level, empowering educators to manage LTI tools within their own courses.

  3. And an update on the progress of our work on the Activity Card redesign, part of our ‘forever’ journey of helping our educators provide engaging learning experiences to their learners.

For our Moodle Partners, without whom we couldn’t do what we do, we progressed work that matters to them, including:

  1. An important security improvement, critical for compliance requirements.

  2. Progress towards the launch of Learning Catalogues in Workplace, supporting self-directed learning out of the box in Moodle.

  3. The introduction of a Child Theme for Moodle Workplace, making custom theme administration less time-consuming and less risky.

  4. And the redressing of a bunch of ‘hot topic’ bugs & issues raised for Moodle Workplace.

  

Our Moodle Mobile App Users will soon benefit from a number of new improvements that drive more consistency with our Moodle LMS desktop version, enhance global search functionality, and provide app administrators with advanced analytics capabilities.

And finally, for all Moodlers, we know that one of the most important things we do is engage with you and seek your feedback, input and contributions to Moodle’s product development. 

This sprint we progressed a number of activities that give us the opportunity to do more of that directly within our product solutions:

  1. We are launching a new Net Promoter & Feedback functionality on our Moodle Cloud standard plan service, which makes it easier for our users to provide us with their insights as they are using our solution. 

  2. Our Moodle Cloud team is also getting into the rhythm of something called ‘continuous discovery’ which means that we are constantly having short but important discussions with our users, ongoingly informing our plans and development efforts.

  3. And we are also embedding direct feedback functionality on moodle.org, providing you with an opportunity to tell us how we can make the home of our community even better than it already is. 

Until next sprint!

The Moodle Products Team

Tech/News/2023/32

Other languages: Bahasa Indonesia, Deutsch, English, Tiếng Việt, Türkçe, español, français, italiano, norsk bokmål, polski, suomi, svenska, čeština, русский, українська, עברית, العربية, فارسی, हिन्दी, বাংলা,…